-
Notifications
You must be signed in to change notification settings - Fork 1
Very simple database schema and data migrations for django.
License
drewvolpe/django-simple-migration
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
django-simple-migration is a very simple schema migrator for Django. Yes, there are a few different existing migration libraries. I wanted something that let me write a SQL or Python file for each upgrade and then would run them as needed, keeping track of what version it was currently on. So I wrote it. This does exactly that and nothing else. It's still a work in progress, but is functional and actively used for at least two production sites. To install: -copy the "management" folder into your django project. -add '<project name>.migration' to the INSTALLED_APPS in your settings.py -create a 1.sql with your first migration in it. (there's an example one in there which creates a new table) -run "python manage.py upgrade -n 1 -e" to perform the upgrade. That's it. For future migrations, create 2.sql, 3.sql, etc. You can also have migrations which are python files; simply create 2.py, 3.py, etc. -To go back, you can run "python manage.py downgrade" to perform a downgrade. This assumes that you've created d_2.sql, d_3.sql, etc. which does the appropriate actions to undo the migration. It is recommended (but not required) to write a downgrade for each upgrade. Admin App and syncdb configuration If you want to use the admin app to view the migrations that have been run on your project, uncomment the admin.py and replace PROJECT_NAME with your project's name. Similarly, to use syncdb functionality, replace PROJECT_NAME in migration/management/__init__.py This will enable a post syncdb signal so that any time syncdb is run, the schema will be setup by running all of the upgrades in /migration/db/ in order. This is useful for dev checkouts, etc. Questions, thoughts, stones: @drewvolpe or dv@dewdrops.net
About
Very simple database schema and data migrations for django.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published