Chunks: move to reside under the collection.
parent
1d5baece1e
commit
393b85d3ca
@ -0,0 +1,19 @@
|
||||
# Generated by Django 3.0.3 on 2020-08-04 12:08
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('django_etebase', '0022_auto_20200804_1059'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='collectionitemchunk',
|
||||
name='collection',
|
||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='chunks', to='django_etebase.Collection'),
|
||||
),
|
||||
]
|
@ -0,0 +1,22 @@
|
||||
# Generated by Django 3.0.3 on 2020-08-04 12:09
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def change_chunk_to_collections(apps, schema_editor):
|
||||
CollectionItemChunk = apps.get_model('django_etebase', 'CollectionItemChunk')
|
||||
|
||||
for chunk in CollectionItemChunk.objects.all():
|
||||
chunk.collection = chunk.item.collection
|
||||
chunk.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('django_etebase', '0023_collectionitemchunk_collection'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(change_chunk_to_collections),
|
||||
]
|
@ -0,0 +1,27 @@
|
||||
# Generated by Django 3.0.3 on 2020-08-04 12:16
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('django_etebase', '0024_auto_20200804_1209'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='collectionitemchunk',
|
||||
name='collection',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='chunks', to='django_etebase.Collection'),
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='collectionitemchunk',
|
||||
unique_together={('collection', 'uid')},
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='collectionitemchunk',
|
||||
name='item',
|
||||
),
|
||||
]
|
Loading…
Reference in New Issue