Skip to content

Instantly share code, notes, and snippets.

@specialunderwear
Created September 8, 2019 09:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save specialunderwear/50bde22260b9ed51f3d36c8237d8fa33 to your computer and use it in GitHub Desktop.
Save specialunderwear/50bde22260b9ed51f3d36c8237d8fa33 to your computer and use it in GitHub Desktop.
# Generated by Django 2.2 on 2019-04-22 12:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('through', '0001_initial'),
]
state_operations = [
migrations.CreateModel(
name='ThroughFooBars',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('foo', models.ForeignKey(on_delete=models.deletion.CASCADE, to='through.Foo')),
('bar', models.ForeignKey(on_delete=models.deletion.CASCADE, to='through.Bar')),
],
options={
'db_table': 'through_foo_bars',
'unique_together': (('foo', 'bar'),),
},
),
migrations.AlterField(
model_name='foo',
name='bars',
field=models.ManyToManyField(through='through.ThroughFooBars', to='through.Bar'),
),
]
operations = [
migrations.SeparateDatabaseAndState(state_operations=state_operations),
migrations.AddField(
model_name='throughfoobars',
name='order',
field=models.PositiveIntegerField(default=0),
),
migrations.AlterModelOptions(
name='throughfoobars',
options={'ordering': ('order',)},
),
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment