I edited two fields on the model and changed them from IntegerField
to TimeField
s:
class Model(models.Model): start_time = models.TimeField() end_time = models.TimeField()
I use these two fields to save a naive time that is not associated with any geographical concept of time, and therefore does not have a real โtime zoneโ (think of something like this race). My local database is PostgreSQL.
However, southern migration generated from this change fails with the following error:
> main:0005_auto__chg_field_model_start_time__chg_field_model_end_time FATAL ERROR - The following SQL query failed: ALTER TABLE "main_model" ALTER COLUMN "start_time" TYPE time, ALTER COLUMN "start_time" SET NOT NULL, ALTER COLUMN "start_time" DROP DEFAULT; ... File ".../lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 52, in execute return self.cursor.execute(query, args) django.db.utils.DatabaseError: column "start_time" cannot be cast to type time without time zone
Failed to migrate:
class Migration(SchemaMigration): def forwards(self, orm):
Any idea on how to make postgres happy in this migration?
PS I'm in the midst of development, so I really don't need data migrations. You can assume that the database is empty.
source share