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

Already on GitHub? Sign in to your account

Fixed #22170 -- Added migrations for contrib apps #2590

Closed
wants to merge 5 commits into
from

Conversation

Projects
None yet
3 participants
Member

claudep commented Apr 19, 2014

No description provided.

@timgraham timgraham commented on the diff Apr 30, 2014

django/contrib/auth/migrations/initial.py
@@ -0,0 +1,69 @@
+from __future__ import unicode_literals
@timgraham

timgraham Apr 30, 2014

Owner

is there a reason this file name doesn't have the 0001_ prefix like the others?

@claudep

claudep Apr 30, 2014

Member

yes, if it starts with a number, it cannot be imported (unless I missed something), then we have to duplicate the file content in django/contrib/auth/tests/migrations/<0001_?>initial.py. If anyone has a better alternative (preventing duplication and allow naming it with 0001_), please speak!
I thought about allowing several paths in MIGRATION_MODULES, but didn't dig more in that direction.

@timgraham

timgraham May 1, 2014

Owner

Ah, can't think of any alternative.

@timgraham timgraham commented on the diff Apr 30, 2014

django/contrib/auth/tests/migrations/initial.py
@@ -0,0 +1 @@
+from django.contrib.auth.migrations.initial import Migration
@loic

loic May 4, 2014

Member
import importlib

initial_migration = importlib.import_module('django.contrib.auth.migrations.0001_initial')

Migration = initial_migration.Migration

It's not pretty but that's how migrations load modules anyway. I prefer some ugliness constrained in tests than an inconsistency in core.

@timgraham timgraham commented on the diff Apr 30, 2014

django/contrib/redirects/migrations/0001_initial.py
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('sites', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Redirect',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('site', models.ForeignKey(to='sites.Site', to_field='id')),
@timgraham

timgraham Apr 30, 2014

Owner

I'm reminded of #21381 (removing contrib.redirects dependency on contrib.sites), but not sure that should block this.

@claudep

claudep Apr 30, 2014

Member

We might be able to remove the dependency after the initial migration, probably.

I couldn't see why 0002_invented is required so I committed the contrib.redirects migration without it. Please add it if necessary.

Owner

timgraham commented Jun 16, 2014

These have been added, thanks!

@timgraham timgraham closed this Jun 16, 2014

@claudep claudep deleted the claudep:contrib_migrations branch Jun 17, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment