Skip to content

Allow use of native migrations in 1.7 #1653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 71 commits into from

Conversation

carltongibson
Copy link
Collaborator

First pass at #1559.

South provides a SOUTH_MIGRATION_MODULES setting. We use this to move the existing migrations to one side.

1.7's makemigrations is responsible for the new migration.

Adding the South setting to rest_framework.setttings doesn't work — and (of course) there's no reason that it should.

But manually adding it to your own settings.py does work. The following works:

mkvirtualenv drf-1.6
pip install -r requirements.txt 
pip install South
django-admin.py startproject playgound
cd playground
ln -s ../rest_framework/ rest_framework 
# Add rest_framework, rest_framework.authtoken, south to settings.
# Add SOUTH_MIGRATION_MODULES setting
./manage.py syncdb
./manage.py migrate --list # Just the unapplied authtoken migration
./manage.py migrate --all

I need to back out the change to rest_framework.setttings and document (where?) the change and (at first glance) it looks good.

Thoughts?

tomchristie and others added 30 commits June 27, 2013 20:29

# 1.7 Migration Compatibility

'SOUTH_MIGRATION_MODULES': {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work here. Needs to be in actual settings. That needs to be added to the docs.

@xordoquy
Copy link
Collaborator

@carltongibson thanks for the PR and the tests.
As for the documentation, there should be mention about this in the authtoken section (http://www.django-rest-framework.org/api-guide/authentication#tokenauthentication) and a huge warning in the release notes.

@carltongibson
Copy link
Collaborator Author

OK — I'll draft the changes there. (Do we have Work In Progress release notes anywhere?)

@xordoquy
Copy link
Collaborator

Release notes are part of the repository (docs/topics/release-notes.md). We'll add items above the 2.3.14 release.

@carltongibson
Copy link
Collaborator Author

Fine. I'll put the notes there. Thanks

…IGRATION_MODULES` setting from `rest_framework.settings`
This tells South to look in the `south_migrations` module for the `authtoken` app.

----


If you're using a [custom user model][custom-user-model] you'll need to make sure that any initial migration that creates the user table runs before the authtoken table is created.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without thinking about it, I'm not sure what needs to be said in this section.

Topics are:

  1. Migration dependencies. (Not sure, yet, how Django handles that)
  2. post_save creation of tokens — I'd guess this remains unchanged but need to think it through.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grumble, grumble... :) Django uses depenencies rather than needed_by but looks okay other than that.

https://docs.djangoproject.com/en/1.7/topics/migrations/#migration-files

I'll edit later on

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will change anything for those two points. We are just using an alternative location for south's modules.
However I don't know the minimum south version that will support that configuration option.

@carltongibson
Copy link
Collaborator Author

@xordoquy — OK, I've done something wrong...

I merged the 2.4.0 branch into my #1559 — https://github.com/carltongibson/django-rest-framework/tree/%231559 — but when I go to compare against 2.4.0 GitHub "can't find anything to compare".

As far as I can see my branch is a straight 3 commits ahead of 2.4.0 so I'm not sure what I've done. Could you review?

Thanks!

@xordoquy
Copy link
Collaborator

@carltongibson will do that after meal.

@carltongibson
Copy link
Collaborator Author

Cool. Thanks.

On 24 Jun 2014, at 10:50, Xavier Ordoquy notifications@github.com wrote:

@carltongibson will do that after meal.


Reply to this email directly or view it on GitHub.

@carltongibson
Copy link
Collaborator Author

@xordoquy — I tried with a different branch name — and now it works — see #1654

@carltongibson carltongibson deleted the #1559 branch June 24, 2014 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy