diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-04-28 21:10:16 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-05-08 16:18:12 +0100 |
commit | 09a1ff974362216a9ebf40e5dad86b171d161b0c (patch) | |
tree | 8f06acf54fe1daacf152915dfe8d8cf79a191923 /bitbake | |
parent | 1a10bd3036b8943e2626ac6e033e1f9b21e1a571 (diff) | |
download | poky-09a1ff974362216a9ebf40e5dad86b171d161b0c.tar.gz |
bitbake: toaster: fix migration code for MySQL
This is a patch that fixes the 0004, 0005 migrations of the toaster
model to get them to properly work with MySQL.
These migrations had a conflict around Build.timespent field.
The sqlite3 constraits were not enough to detect the conflict, and
the migrations worked as expected.
MySQL objected to adding the field twice, so I did regenerate
the migrations with the correct model listing. The net effect
is the same, so the migrations work the same, but now we
can use these two migration on the MySQL and other more advanced
SQL engines.
(Bitbake rev: 29afc29154b948d270ce52978a1eed4cd8887f92)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
2 files changed, 19 insertions, 38 deletions
diff --git a/bitbake/lib/toaster/orm/migrations/0004_auto__add_field_package_installed_name.py b/bitbake/lib/toaster/orm/migrations/0004_auto__add_field_package_installed_name.py index ca114de6bf..fc5ff53e54 100644 --- a/bitbake/lib/toaster/orm/migrations/0004_auto__add_field_package_installed_name.py +++ b/bitbake/lib/toaster/orm/migrations/0004_auto__add_field_package_installed_name.py | |||
@@ -34,6 +34,7 @@ class Migration(SchemaMigration): | |||
34 | 'machine': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | 34 | 'machine': ('django.db.models.fields.CharField', [], {'max_length': '100'}), |
35 | 'outcome': ('django.db.models.fields.IntegerField', [], {'default': '2'}), | 35 | 'outcome': ('django.db.models.fields.IntegerField', [], {'default': '2'}), |
36 | 'started_on': ('django.db.models.fields.DateTimeField', [], {}), | 36 | 'started_on': ('django.db.models.fields.DateTimeField', [], {}), |
37 | 'timespent': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | ||
37 | 'warnings_no': ('django.db.models.fields.IntegerField', [], {'default': '0'}) | 38 | 'warnings_no': ('django.db.models.fields.IntegerField', [], {'default': '0'}) |
38 | }, | 39 | }, |
39 | u'orm.layer': { | 40 | u'orm.layer': { |
diff --git a/bitbake/lib/toaster/orm/migrations/0005_auto__add_target_image_file__add_target_file__add_field_variablehistor.py b/bitbake/lib/toaster/orm/migrations/0005_auto__add_target_image_file__add_target_file__add_field_variablehistor.py index a55451c6da..fd1d153bb7 100644 --- a/bitbake/lib/toaster/orm/migrations/0005_auto__add_target_image_file__add_target_file__add_field_variablehistor.py +++ b/bitbake/lib/toaster/orm/migrations/0005_auto__add_target_image_file__add_target_file__add_field_variablehistor.py | |||
@@ -8,15 +8,6 @@ from django.db import models | |||
8 | class Migration(SchemaMigration): | 8 | class Migration(SchemaMigration): |
9 | 9 | ||
10 | def forwards(self, orm): | 10 | def forwards(self, orm): |
11 | # Adding model 'Target_Image_File' | ||
12 | db.create_table(u'orm_target_image_file', ( | ||
13 | (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), | ||
14 | ('target', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['orm.Target'])), | ||
15 | ('file_name', self.gf('django.db.models.fields.FilePathField')(max_length=100)), | ||
16 | ('file_size', self.gf('django.db.models.fields.IntegerField')()), | ||
17 | )) | ||
18 | db.send_create_signal(u'orm', ['Target_Image_File']) | ||
19 | |||
20 | # Adding model 'Target_File' | 11 | # Adding model 'Target_File' |
21 | db.create_table(u'orm_target_file', ( | 12 | db.create_table(u'orm_target_file', ( |
22 | (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), | 13 | (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), |
@@ -32,6 +23,15 @@ class Migration(SchemaMigration): | |||
32 | )) | 23 | )) |
33 | db.send_create_signal(u'orm', ['Target_File']) | 24 | db.send_create_signal(u'orm', ['Target_File']) |
34 | 25 | ||
26 | # Adding model 'Target_Image_File' | ||
27 | db.create_table(u'orm_target_image_file', ( | ||
28 | (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), | ||
29 | ('target', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['orm.Target'])), | ||
30 | ('file_name', self.gf('django.db.models.fields.FilePathField')(max_length=100)), | ||
31 | ('file_size', self.gf('django.db.models.fields.IntegerField')()), | ||
32 | )) | ||
33 | db.send_create_signal(u'orm', ['Target_Image_File']) | ||
34 | |||
35 | # Adding field 'VariableHistory.value' | 35 | # Adding field 'VariableHistory.value' |
36 | db.add_column(u'orm_variablehistory', 'value', | 36 | db.add_column(u'orm_variablehistory', 'value', |
37 | self.gf('django.db.models.fields.TextField')(default='', blank=True), | 37 | self.gf('django.db.models.fields.TextField')(default='', blank=True), |
@@ -49,11 +49,6 @@ class Migration(SchemaMigration): | |||
49 | # Deleting field 'Build.image_fstypes' | 49 | # Deleting field 'Build.image_fstypes' |
50 | db.delete_column(u'orm_build', 'image_fstypes') | 50 | db.delete_column(u'orm_build', 'image_fstypes') |
51 | 51 | ||
52 | # Adding field 'Build.timespent' | ||
53 | db.add_column(u'orm_build', 'timespent', | ||
54 | self.gf('django.db.models.fields.IntegerField')(default=0), | ||
55 | keep_default=False) | ||
56 | |||
57 | # Adding field 'LogMessage.task' | 52 | # Adding field 'LogMessage.task' |
58 | db.add_column(u'orm_logmessage', 'task', | 53 | db.add_column(u'orm_logmessage', 'task', |
59 | self.gf('django.db.models.fields.related.ForeignKey')(to=orm['orm.Task'], null=True, blank=True), | 54 | self.gf('django.db.models.fields.related.ForeignKey')(to=orm['orm.Task'], null=True, blank=True), |
@@ -70,12 +65,12 @@ class Migration(SchemaMigration): | |||
70 | # Removing unique constraint on 'Task', fields ['build', 'recipe', 'task_name'] | 65 | # Removing unique constraint on 'Task', fields ['build', 'recipe', 'task_name'] |
71 | db.delete_unique(u'orm_task', ['build_id', 'recipe_id', 'task_name']) | 66 | db.delete_unique(u'orm_task', ['build_id', 'recipe_id', 'task_name']) |
72 | 67 | ||
73 | # Deleting model 'Target_Image_File' | ||
74 | db.delete_table(u'orm_target_image_file') | ||
75 | |||
76 | # Deleting model 'Target_File' | 68 | # Deleting model 'Target_File' |
77 | db.delete_table(u'orm_target_file') | 69 | db.delete_table(u'orm_target_file') |
78 | 70 | ||
71 | # Deleting model 'Target_Image_File' | ||
72 | db.delete_table(u'orm_target_image_file') | ||
73 | |||
79 | # Deleting field 'VariableHistory.value' | 74 | # Deleting field 'VariableHistory.value' |
80 | db.delete_column(u'orm_variablehistory', 'value') | 75 | db.delete_column(u'orm_variablehistory', 'value') |
81 | 76 | ||
@@ -84,36 +79,21 @@ class Migration(SchemaMigration): | |||
84 | self.gf('django.db.models.fields.TextField')(default='', blank=True), | 79 | self.gf('django.db.models.fields.TextField')(default='', blank=True), |
85 | keep_default=False) | 80 | keep_default=False) |
86 | 81 | ||
87 | 82 | # Adding field 'Target.file_name' | |
88 | # User chose to not deal with backwards NULL issues for 'Target.file_name' | ||
89 | raise RuntimeError("Cannot reverse this migration. 'Target.file_name' and its values cannot be restored.") | ||
90 | |||
91 | # The following code is provided here to aid in writing a correct migration # Adding field 'Target.file_name' | ||
92 | db.add_column(u'orm_target', 'file_name', | 83 | db.add_column(u'orm_target', 'file_name', |
93 | self.gf('django.db.models.fields.CharField')(max_length=100), | 84 | self.gf('django.db.models.fields.CharField')(default='', max_length=100), |
94 | keep_default=False) | 85 | keep_default=False) |
95 | 86 | ||
96 | 87 | # Adding field 'Target.file_size' | |
97 | # User chose to not deal with backwards NULL issues for 'Target.file_size' | ||
98 | raise RuntimeError("Cannot reverse this migration. 'Target.file_size' and its values cannot be restored.") | ||
99 | |||
100 | # The following code is provided here to aid in writing a correct migration # Adding field 'Target.file_size' | ||
101 | db.add_column(u'orm_target', 'file_size', | 88 | db.add_column(u'orm_target', 'file_size', |
102 | self.gf('django.db.models.fields.IntegerField')(), | 89 | self.gf('django.db.models.fields.IntegerField')(default=0), |
103 | keep_default=False) | 90 | keep_default=False) |
104 | 91 | ||
105 | 92 | # Adding field 'Build.image_fstypes' | |
106 | # User chose to not deal with backwards NULL issues for 'Build.image_fstypes' | ||
107 | raise RuntimeError("Cannot reverse this migration. 'Build.image_fstypes' and its values cannot be restored.") | ||
108 | |||
109 | # The following code is provided here to aid in writing a correct migration # Adding field 'Build.image_fstypes' | ||
110 | db.add_column(u'orm_build', 'image_fstypes', | 93 | db.add_column(u'orm_build', 'image_fstypes', |
111 | self.gf('django.db.models.fields.CharField')(max_length=100), | 94 | self.gf('django.db.models.fields.CharField')(default='', max_length=100), |
112 | keep_default=False) | 95 | keep_default=False) |
113 | 96 | ||
114 | # Deleting field 'Build.timespent' | ||
115 | db.delete_column(u'orm_build', 'timespent') | ||
116 | |||
117 | # Deleting field 'LogMessage.task' | 97 | # Deleting field 'LogMessage.task' |
118 | db.delete_column(u'orm_logmessage', 'task_id') | 98 | db.delete_column(u'orm_logmessage', 'task_id') |
119 | 99 | ||