#31761: Gracefull Migration | relation already exists
-------------------------------------+-------------------------------------
Reporter: G-kodes | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: | Version: 3.0
Migrations | Keywords: migration
Severity: Normal | programming error
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I have noticed that Django's migration system cannot gracefully handle a
semi-populated DB.
== Problem
I am stuck in a situation where we maintain development and deployment
environments, each with slightly different migrations due to error and bug
fixing and the fact that the DB is not backed up to the dev environment.
As a result, we do not track/sync migration files between the two as they
would not be compatible with the tracked files in each DB. Recently we
have just had to wipe and re-start our migrations due to some hardware
complications and it has come up that we cannot simply re-generate
migration files as Django will attempt to re-create all migration files
and all models from scratch. Obviously this is kicking up a
`django.db.utils.ProgrammingError: relation "<Table_Name_Here>" already
exists` which is not very easily fixable.
== Solution/My Request:
I could always play around with the migration files or some such and tweak
them until the migrations work but that is not ideal, especially in a
production environment. It would be more intuitive to me for Django to
check against the database whether or not any of the database tables
already exist and optionally (Maybe a command flag?), only migrate
'''new''' model tables/fields?
--
Ticket URL: <https://code.djangoproject.com/ticket/31761>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.0e4168eeacd1da306b7133c47fafe2c3%40djangoproject.com.