Opened 10 years ago

Last modified 10 years ago

#23966 closed Cleanup/optimization

Doing pre-migrate database requirements — at Version 3

Reported by: Kenial Sookyum Lee Owned by: nobody
Component: Database layer (models, ORM) Version: 1.7
Severity: Normal Keywords: migrate BaseDatabaseWrapper spatialite
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Kenial Sookyum Lee)

Some database backends has special requirements when the database gets migrated.

For example, when using django.contrib.gis.db.backends.spatialite as a backend, the database file should be initialized at first time with this command: "SELECT InitSpatialMetaData();" Unless, it causes some error like https://code.djangoproject.com/ticket/20968.

I guess this would be appropriate: adding a before_migration() method to DatabaseWrapper, and letting database backends inherit it to do some jobs.

New workaround codes are added to django/contrib/gis/apps.py. (Thanks @aaugustin!)

Pull request link: https://github.com/django/django/pull/3695

Change History (3)

comment:1 by Kenial Sookyum Lee, 10 years ago

Cc: keniallee@… added
Summary: Pre-migrate database requirements enhancementDoing pre-migrate database requirements

comment:2 by Aymeric Augustin, 10 years ago

Look at django/contrib/postgres/apps.py for how to implement this.

comment:3 by Kenial Sookyum Lee, 10 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top