Please help me with this error:
File "/Users/ecommerce/proshopvenv/lib/python3.8/site-packages/django/db/backends/utils.py",
line 84, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.CannotCoerce: cannot cast type date to time without time zone
LINE 1: ..." ALTER COLUMN "createdAt" TYPE time USING "createdAt"::time
The above exception was the direct cause of the following exception:
"a lot of code, and:"
django.db.utils.ProgrammingError: cannot cast type date to time without time zone
LINE 1: ..." ALTER COLUMN "createdAt" TYPE time USING "createdAt"::time
In models i have:
createdAt = models.DateTimeField(auto_now_add=True)
and how i understand from docs https://docs.djangoproject.com/en/3.2/ref/models/fields/
"The auto_now and auto_now_add options will always use the date in the default timezone at the moment of creation or update."
But zone doesn't create, or error in something else, i creating new database, so i can delete all tables
Maybe there is step in django where it initials time zone?
Readed this topic postgreSQL alter column data type to timestamp without time zone and many others but can't fix it to 'migrate' without errors
TIME_ZONE = 'Asia/Kolkata'- Vivek AnandALTER COLUMN "createdAt" TYPE time USING "createdAt"::time". Something is trying to alter thetypeof yourcreatedAtfield away from some form ofdate(I presume) to atimetype. That is not what you want. You need to track down what is doing this. - Adrian Klaverdatetotimewithouttime zone- Marat Mag