Change how we handle chunk ordering (and relation).
parent
7a0a00c738
commit
62a7496b66
@ -0,0 +1,37 @@
|
|||||||
|
# Generated by Django 3.0.3 on 2020-04-15 14:20
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('django_etesync', '0035_auto_20200415_1259'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='collectionitemchunk',
|
||||||
|
options={},
|
||||||
|
),
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name='collectionitemchunk',
|
||||||
|
unique_together=set(),
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='RevisionChunkRelation',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('chunk', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='revisions_relation', to='django_etesync.CollectionItemChunk')),
|
||||||
|
('revision', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='chunks_relation', to='django_etesync.CollectionItemRevision')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ('id',),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='collectionitemchunk',
|
||||||
|
name='order',
|
||||||
|
),
|
||||||
|
]
|
@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 3.0.3 on 2020-04-15 14:21
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
def change_chunk_relation(apps, schema_editor):
|
||||||
|
CollectionItemRevision = apps.get_model('django_etesync', 'CollectionItemRevision')
|
||||||
|
RevisionChunkRelation = apps.get_model('django_etesync', 'RevisionChunkRelation')
|
||||||
|
|
||||||
|
for revision in CollectionItemRevision.objects.all():
|
||||||
|
for chunk in revision.chunks.all():
|
||||||
|
RevisionChunkRelation.objects.create(chunk=chunk, revision=revision)
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('django_etesync', '0036_auto_20200415_1420'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(change_chunk_relation),
|
||||||
|
]
|
@ -0,0 +1,17 @@
|
|||||||
|
# Generated by Django 3.0.3 on 2020-04-15 14:34
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('django_etesync', '0037_auto_20200415_1421'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='collectionitemrevision',
|
||||||
|
name='chunks',
|
||||||
|
),
|
||||||
|
]
|
Loading…
Reference in New Issue