python - Make Django forget an incorrect 'makemigration' -
python - Make Django forget an incorrect 'makemigration' -
i'm working on django app i've migrated basic model. there no info saved table representing model (i'm using postgresql). i've since added new variable under original model class, like:
time_entered = models.datetimefield(auto_now_add=true) i must entered default time in invalid format, maybe default = datetime.datetime.now(), because django gave me error when tried migrate new variable:
running migrations: applying app.0002_model_time_entered... traceback: ... django.core.exceptions.validationerror: ["'' value has invali format. must in yyyy-mm-dd hh:mm[:ss[.uuuuuu]][tz] format."]
i've commented out time_entered, i've used django's timezone set default value right format, , i've set default value string in right format. each time, when seek makemigrations , migrate, same error , django won't commit changes database. i'm getting error when seek @ sql commands sqlmigrate. (to clarify, sqlmigrate works recent makemigrations minor changes, not early, uncommitted makemigration attempts had actual error.)
what can do? how can django stop beingness stubborn , allow go of old, wrong sql command? there way delete uncommitted sql commands makemigration? can't migrate right now.
used , unused migrations hang out in ./app/migrations. deleted migration files after initial migration, ran new makemigrations didn't have format error.
i'm not satisfied solution. i'd still love hear improve answer.
python django postgresql django-1.7
Comments
Post a Comment