Moar migration fixes
This commit is contained in:
parent
0fc168e147
commit
1f484c625d
4 changed files with 153 additions and 16 deletions
|
@ -16,12 +16,6 @@ class Migration(migrations.Migration):
|
||||||
run_before = [
|
run_before = [
|
||||||
('cmsplugin_filer_image', '0004_auto_20160120_0950'),
|
('cmsplugin_filer_image', '0004_auto_20160120_0950'),
|
||||||
]
|
]
|
||||||
else:
|
|
||||||
dependencies = [
|
|
||||||
('filer', '__first__'),
|
|
||||||
('cmsplugin_filer_image', '__first__'),
|
|
||||||
('djangocms_blog', '0016_auto_20160502_1741'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
|
@ -39,3 +33,11 @@ class Migration(migrations.Migration):
|
||||||
to=thumbnail_model, null=True),
|
to=thumbnail_model, null=True),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
else:
|
||||||
|
dependencies = [
|
||||||
|
('filer', '__first__'),
|
||||||
|
('cmsplugin_filer_image', '__first__'),
|
||||||
|
('djangocms_blog', '0016_auto_20160502_1741'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = []
|
||||||
|
|
43
djangocms_blog/migrations/0018_thumbnail_move2.py
Normal file
43
djangocms_blog/migrations/0018_thumbnail_move2.py
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
from djangocms_blog.models import thumbnail_model
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
if 'cmsplugin_filer' not in thumbnail_model:
|
||||||
|
dependencies = [
|
||||||
|
('djangocms_blog', '0017_thumbnail_move'),
|
||||||
|
('filer', '0003_thumbnailoption'),
|
||||||
|
('cmsplugin_filer_image', '0003_mv_thumbnail_option_to_filer_20160119_1720'),
|
||||||
|
]
|
||||||
|
run_before = [
|
||||||
|
('cmsplugin_filer_image', '0004_auto_20160120_0950'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='post',
|
||||||
|
name='main_image_full_new',
|
||||||
|
field=models.ForeignKey(related_name='djangocms_blog_post_full',
|
||||||
|
verbose_name='Main image full', blank=True,
|
||||||
|
to=thumbnail_model, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='post',
|
||||||
|
name='main_image_thumbnail_new',
|
||||||
|
field=models.ForeignKey(related_name='djangocms_blog_post_thumbnail',
|
||||||
|
verbose_name='Main image thumbnail', blank=True,
|
||||||
|
to=thumbnail_model, null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
dependencies = [
|
||||||
|
('filer', '__first__'),
|
||||||
|
('cmsplugin_filer_image', '__first__'),
|
||||||
|
('djangocms_blog', '0017_thumbnail_move'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = []
|
45
djangocms_blog/migrations/0019_thumbnail_move3.py
Normal file
45
djangocms_blog/migrations/0019_thumbnail_move3.py
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
from djangocms_blog.models import thumbnail_model
|
||||||
|
|
||||||
|
|
||||||
|
def move_thumbnail_opt_to_filer(apps, schema_editor):
|
||||||
|
Post = apps.get_model('djangocms_blog', 'Post')
|
||||||
|
for post in Post.objects.all():
|
||||||
|
post.main_image_full_new_id = post.main_image_full_id
|
||||||
|
post.main_image_thumbnail_new_id = post.main_image_thumbnail_id
|
||||||
|
post.save()
|
||||||
|
|
||||||
|
|
||||||
|
def move_thumbnail_opt_to_plugin(apps, schema_editor):
|
||||||
|
Post = apps.get_model('djangocms_blog', 'Post')
|
||||||
|
for post in Post.objects.all():
|
||||||
|
post.main_image_full_id = post.main_image_full_new_id
|
||||||
|
post.main_image_thumbnail_id = post.main_image_thumbnail_new_id
|
||||||
|
post.save()
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
if 'cmsplugin_filer' not in thumbnail_model:
|
||||||
|
dependencies = [
|
||||||
|
('djangocms_blog', '0018_thumbnail_move2'),
|
||||||
|
('filer', '0003_thumbnailoption'),
|
||||||
|
('cmsplugin_filer_image', '0003_mv_thumbnail_option_to_filer_20160119_1720'),
|
||||||
|
]
|
||||||
|
run_before = [
|
||||||
|
('cmsplugin_filer_image', '0004_auto_20160120_0950'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(move_thumbnail_opt_to_filer, move_thumbnail_opt_to_plugin),
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
dependencies = [
|
||||||
|
('filer', '__first__'),
|
||||||
|
('cmsplugin_filer_image', '__first__'),
|
||||||
|
('djangocms_blog', '0018_thumbnail_move2'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = []
|
47
djangocms_blog/migrations/0020_thumbnail_move4.py
Normal file
47
djangocms_blog/migrations/0020_thumbnail_move4.py
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
from djangocms_blog.models import thumbnail_model
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
if 'cmsplugin_filer' not in thumbnail_model:
|
||||||
|
dependencies = [
|
||||||
|
('djangocms_blog', '0019_thumbnail_move3'),
|
||||||
|
('filer', '0003_thumbnailoption'),
|
||||||
|
('cmsplugin_filer_image', '0003_mv_thumbnail_option_to_filer_20160119_1720'),
|
||||||
|
]
|
||||||
|
run_before = [
|
||||||
|
('cmsplugin_filer_image', '0004_auto_20160120_0950'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='post',
|
||||||
|
name='main_image_full'
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='post',
|
||||||
|
name='main_image_thumbnail',
|
||||||
|
),
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name='post',
|
||||||
|
old_name='main_image_full_new',
|
||||||
|
new_name='main_image_full',
|
||||||
|
),
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name='post',
|
||||||
|
old_name='main_image_thumbnail_new',
|
||||||
|
new_name='main_image_thumbnail',
|
||||||
|
)
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
dependencies = [
|
||||||
|
('filer', '__first__'),
|
||||||
|
('cmsplugin_filer_image', '__first__'),
|
||||||
|
('djangocms_blog', '0019_thumbnail_move3'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = []
|
Loading…
Reference in a new issue