From 19bd63fc3a28dcbd0f531a5b06a037da34568bac Mon Sep 17 00:00:00 2001 From: Michael Wood Date: Thu, 18 Feb 2016 21:21:48 -0800 Subject: [PATCH] toaster: orm migrations Sort out migrations mess We messed up the migrations by squashing some of the image customisation model definitions into the initial migration which has meant some irreversible operations on mysql took place. This deletes, re-orders and fixes the migrations. If your schema is up to date you may want to use ./manage migrate with --fake or --fake-initial to avoid re-applying migrations. [YOCTO #9116] Signed-off-by: brian avery Signed-off-by: Richard Purdie --- lib/toaster/orm/migrations/0001_initial.py | 26 ------------ .../orm/migrations/0002_auto_20151210_1209.py | 41 ------------------- .../orm/migrations/0002_customimagerecipe.py | 24 +++++++++++ .../orm/migrations/0003_customimagepackage.py | 2 +- lib/toaster/orm/migrations/0004_merge.py | 15 ------- ...auto_20151223_1528.py => 0004_provides.py} | 2 +- .../orm/migrations/0005_auto_20160118_1055.py | 19 --------- .../0006_customimagerecipe_last_updated.py | 19 --------- 8 files changed, 26 insertions(+), 122 deletions(-) delete mode 100644 lib/toaster/orm/migrations/0002_auto_20151210_1209.py create mode 100644 lib/toaster/orm/migrations/0002_customimagerecipe.py delete mode 100644 lib/toaster/orm/migrations/0004_merge.py rename lib/toaster/orm/migrations/{0002_auto_20151223_1528.py => 0004_provides.py} (94%) delete mode 100644 lib/toaster/orm/migrations/0005_auto_20160118_1055.py delete mode 100644 lib/toaster/orm/migrations/0006_customimagerecipe_last_updated.py diff --git a/lib/toaster/orm/migrations/0001_initial.py b/lib/toaster/orm/migrations/0001_initial.py index 27fd05716fa..760462f6b4c 100644 --- a/lib/toaster/orm/migrations/0001_initial.py +++ b/lib/toaster/orm/migrations/0001_initial.py @@ -57,13 +57,6 @@ class Migration(migrations.Migration): ('build', models.ForeignKey(to='orm.Build')), ], ), - migrations.CreateModel( - name='CustomImageRecipe', - fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('name', models.CharField(max_length=100)), - ], - ), migrations.CreateModel( name='HelpText', fields=[ @@ -435,21 +428,6 @@ class Migration(migrations.Migration): name='layer_source', field=models.ForeignKey(default=None, to='orm.LayerSource', null=True), ), - migrations.AddField( - model_name='customimagerecipe', - name='base_recipe', - field=models.ForeignKey(to='orm.Recipe'), - ), - migrations.AddField( - model_name='customimagerecipe', - name='packages', - field=models.ManyToManyField(to='orm.Package'), - ), - migrations.AddField( - model_name='customimagerecipe', - name='project', - field=models.ForeignKey(to='orm.Project'), - ), migrations.AddField( model_name='build', name='project', @@ -519,10 +497,6 @@ class Migration(migrations.Migration): name='layer', unique_together=set([('layer_source', 'up_id'), ('layer_source', 'name')]), ), - migrations.AlterUniqueTogether( - name='customimagerecipe', - unique_together=set([('name', 'project')]), - ), migrations.AlterUniqueTogether( name='branch', unique_together=set([('layer_source', 'up_id'), ('layer_source', 'name')]), diff --git a/lib/toaster/orm/migrations/0002_auto_20151210_1209.py b/lib/toaster/orm/migrations/0002_auto_20151210_1209.py deleted file mode 100644 index d15ceaa2be4..00000000000 --- a/lib/toaster/orm/migrations/0002_auto_20151210_1209.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('orm', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='customimagerecipe', - name='recipe_ptr', - field=models.OneToOneField(parent_link=True, auto_created=True, default=None, serialize=False, to='orm.Recipe'), - preserve_default=False, - ), - migrations.AlterField( - model_name='customimagerecipe', - name='base_recipe', - field=models.ForeignKey(related_name='based_on_recipe', to='orm.Recipe'), - ), - migrations.AlterUniqueTogether( - name='customimagerecipe', - unique_together=set([]), - ), - migrations.RemoveField( - model_name='customimagerecipe', - name='id', - ), - migrations.RemoveField( - model_name='customimagerecipe', - name='name', - ), - migrations.RemoveField( - model_name='customimagerecipe', - name='packages', - ), - ] diff --git a/lib/toaster/orm/migrations/0002_customimagerecipe.py b/lib/toaster/orm/migrations/0002_customimagerecipe.py new file mode 100644 index 00000000000..9cec82e8d4f --- /dev/null +++ b/lib/toaster/orm/migrations/0002_customimagerecipe.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('orm', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='CustomImageRecipe', + fields=[ + ('recipe_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='orm.Recipe')), + ('last_updated', models.DateTimeField(default=None, null=True)), + ('base_recipe', models.ForeignKey(related_name='based_on_recipe', to='orm.Recipe')), + ('project', models.ForeignKey(to='orm.Project')), + ], + bases=('orm.recipe',), + ), + ] diff --git a/lib/toaster/orm/migrations/0003_customimagepackage.py b/lib/toaster/orm/migrations/0003_customimagepackage.py index d2ea8205b3a..b027f661375 100644 --- a/lib/toaster/orm/migrations/0003_customimagepackage.py +++ b/lib/toaster/orm/migrations/0003_customimagepackage.py @@ -7,7 +7,7 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('orm', '0002_auto_20151210_1209'), + ('orm', '0002_customimagerecipe'), ] operations = [ diff --git a/lib/toaster/orm/migrations/0004_merge.py b/lib/toaster/orm/migrations/0004_merge.py deleted file mode 100644 index 5b9d122c4c0..00000000000 --- a/lib/toaster/orm/migrations/0004_merge.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('orm', '0002_auto_20151223_1528'), - ('orm', '0003_customimagepackage'), - ] - - operations = [ - ] diff --git a/lib/toaster/orm/migrations/0002_auto_20151223_1528.py b/lib/toaster/orm/migrations/0004_provides.py similarity index 94% rename from lib/toaster/orm/migrations/0002_auto_20151223_1528.py rename to lib/toaster/orm/migrations/0004_provides.py index 194c897bdfd..dfde2d13615 100644 --- a/lib/toaster/orm/migrations/0002_auto_20151223_1528.py +++ b/lib/toaster/orm/migrations/0004_provides.py @@ -7,7 +7,7 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('orm', '0001_initial'), + ('orm', '0003_customimagepackage'), ] operations = [ diff --git a/lib/toaster/orm/migrations/0005_auto_20160118_1055.py b/lib/toaster/orm/migrations/0005_auto_20160118_1055.py deleted file mode 100644 index 11205969837..00000000000 --- a/lib/toaster/orm/migrations/0005_auto_20160118_1055.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('orm', '0004_merge'), - ] - - operations = [ - migrations.AlterField( - model_name='customimagerecipe', - name='recipe_ptr', - field=models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='orm.Recipe'), - ), - ] diff --git a/lib/toaster/orm/migrations/0006_customimagerecipe_last_updated.py b/lib/toaster/orm/migrations/0006_customimagerecipe_last_updated.py deleted file mode 100644 index b7a301b5415..00000000000 --- a/lib/toaster/orm/migrations/0006_customimagerecipe_last_updated.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('orm', '0005_auto_20160118_1055'), - ] - - operations = [ - migrations.AddField( - model_name='customimagerecipe', - name='last_updated', - field=models.DateTimeField(default=None, null=True), - ), - ] -- 2.47.3