Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 5C254E00CDE; Wed, 2 Sep 2015 01:57:34 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high * trust * [134.134.136.24 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 482DFE00CC8 for ; Wed, 2 Sep 2015 01:57:21 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 02 Sep 2015 01:57:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,452,1437462000"; d="scan'208";a="796529167" Received: from gionescx-mobl1.ger.corp.intel.com (HELO lp.ger.corp.intel.com) ([10.252.26.81]) by fmsmga002.fm.intel.com with ESMTP; 02 Sep 2015 01:57:11 -0700 From: Elliot Smith To: toaster@yoctoproject.org Date: Wed, 2 Sep 2015 09:56:49 +0100 Message-Id: <1441184214-8074-2-git-send-email-elliot.smith@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1441184214-8074-1-git-send-email-elliot.smith@intel.com> References: <1441184214-8074-1-git-send-email-elliot.smith@intel.com> Subject: [review-request][PATCH 1/6] toaster: Make 0021 migration compatible with MySQL X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Sep 2015 08:57:34 -0000 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] Signed-off-by: Elliot Smith --- ...hg_field_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 924a5c4..a62ddb7 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)) -- Elliot Smith Software Engineer Intel OTC --------------------------------------------------------------------- Intel Corporation (UK) Limited Registered No. 1134945 (England) Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.