From 5b26bbdfe17d36fbdbdeefe99c9054e7657b74fb Mon Sep 17 00:00:00 2001 From: Elliot Smith Date: Wed, 2 Sep 2015 17:25:07 -0700 Subject: [PATCH] bitbake: toaster: Make 0021 migration compatible with MySQL Two issues prevent this migration from working correctly with a MySQL back-end: 1. MySQL won't allow a default value to be set for an AutoField, which is what the migration tries to do for project_id ("ValueError: The database backend does not accept 0 as a value for AutoField.") 2. When migrations are applied to a MySQL back-end, Django (via South) attempts a dry run of the migration first: it applies the forward migration then rolls it back. However, this migration raises an exception on roll back, which causes the whole series of migrations to fail. This commit fixes both issues. [YOCTO #7932] (Bitbake rev: 12f6278d56d7dec57308adc17411802f15d395d7) Signed-off-by: Elliot Smith Signed-off-by: brian avery Signed-off-by: Richard Purdie --- ..._build_project__chg_field_project_bitbake_version__chg_.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bitbake/lib/toaster/orm/migrations/0021_auto__chg_field_build_project__chg_field_project_bitbake_version__chg_.py b/bitbake/lib/toaster/orm/migrations/0021_auto__chg_field_build_project__chg_field_project_bitbake_version__chg_.py index 924a5c4a8a..a62ddb7ee4 100644 --- a/bitbake/lib/toaster/orm/migrations/0021_auto__chg_field_build_project__chg_field_project_bitbake_version__chg_.py +++ b/bitbake/lib/toaster/orm/migrations/0021_auto__chg_field_build_project__chg_field_project_bitbake_version__chg_.py @@ -7,10 +7,12 @@ from django.db import models class Migration(SchemaMigration): + no_dry_run = True + def forwards(self, orm): # Changing field 'Build.project' - db.alter_column(u'orm_build', 'project_id', self.gf('django.db.models.fields.related.ForeignKey')(default=0, to=orm['orm.Project'])) + db.alter_column(u'orm_build', 'project_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['orm.Project'])) # Changing field 'Project.bitbake_version' db.alter_column(u'orm_project', 'bitbake_version_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['orm.BitbakeVersion'], null=True))