summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/orm/migrations
diff options
context:
space:
mode:
authorElliot Smith <elliot.smith@intel.com>2015-09-02 17:25:07 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-03 16:52:48 +0100
commit5b26bbdfe17d36fbdbdeefe99c9054e7657b74fb (patch)
treec565c784bcadb042da6aa60d54b896deab331ded /bitbake/lib/toaster/orm/migrations
parent24d6d3fda83b129dd481c25376dc401b0e258ac7 (diff)
downloadpoky-5b26bbdfe17d36fbdbdeefe99c9054e7657b74fb.tar.gz
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 <elliot.smith@intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/orm/migrations')
-rw-r--r--bitbake/lib/toaster/orm/migrations/0021_auto__chg_field_build_project__chg_field_project_bitbake_version__chg_.py4
1 files changed, 3 insertions, 1 deletions
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
7 7
8class Migration(SchemaMigration): 8class Migration(SchemaMigration):
9 9
10 no_dry_run = True
11
10 def forwards(self, orm): 12 def forwards(self, orm):
11 13
12 # Changing field 'Build.project' 14 # Changing field 'Build.project'
13 db.alter_column(u'orm_build', 'project_id', self.gf('django.db.models.fields.related.ForeignKey')(default=0, to=orm['orm.Project'])) 15 db.alter_column(u'orm_build', 'project_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['orm.Project']))
14 16
15 # Changing field 'Project.bitbake_version' 17 # Changing field 'Project.bitbake_version'
16 db.alter_column(u'orm_project', 'bitbake_version_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['orm.BitbakeVersion'], null=True)) 18 db.alter_column(u'orm_project', 'bitbake_version_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['orm.BitbakeVersion'], null=True))