[bitbake-devel] [PATCH 1/5] toaster: orm migrations Sort out migrations mess
brian avery
avery.brian at gmail.com
Fri Feb 19 05:21:48 UTC 2016
From: Michael Wood <michael.g.wood at intel.com>
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 <avery.brian at gmail.com>
---
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 --------
...0002_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 bitbake/lib/toaster/orm/migrations/0002_auto_20151210_1209.py
create mode 100644 bitbake/lib/toaster/orm/migrations/0002_customimagerecipe.py
delete mode 100644 bitbake/lib/toaster/orm/migrations/0004_merge.py
rename bitbake/lib/toaster/orm/migrations/{0002_auto_20151223_1528.py => 0004_provides.py} (94%)
delete mode 100644 bitbake/lib/toaster/orm/migrations/0005_auto_20160118_1055.py
delete mode 100644 bitbake/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 27fd057..760462f 100644
--- a/lib/toaster/orm/migrations/0001_initial.py
+++ b/lib/toaster/orm/migrations/0001_initial.py
@@ -58,13 +58,6 @@ class Migration(migrations.Migration):
],
),
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=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
@@ -436,21 +429,6 @@ class Migration(migrations.Migration):
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',
field=models.ForeignKey(to='orm.Project'),
@@ -520,10 +498,6 @@ class Migration(migrations.Migration):
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 d15ceaa..0000000
--- 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 0000000..9cec82e
--- /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 d2ea820..b027f66 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 5b9d122..0000000
--- 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 194c897..dfde2d1 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 1120596..0000000
--- 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 b7a301b..0000000
--- 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),
- ),
- ]
--
1.9.1
More information about the bitbake-devel
mailing list