summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-12-14 11:24:57 -0600
committerDan McGee <dan@archlinux.org>2013-12-14 11:24:57 -0600
commita116f0d94221f72fa14d90ec77b9777efbfada65 (patch)
treefb3a6163fb9654f5397186d88e2ef64c3ed36b17
parentd83e0842053b3a4a4dfb31f373d34ecf1e0c5ce2 (diff)
Add update query for extracting Flyspray bug number
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--mirrors/migrations/0027_auto__add_field_mirror_bug.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/mirrors/migrations/0027_auto__add_field_mirror_bug.py b/mirrors/migrations/0027_auto__add_field_mirror_bug.py
index 57727333..f7304ba8 100644
--- a/mirrors/migrations/0027_auto__add_field_mirror_bug.py
+++ b/mirrors/migrations/0027_auto__add_field_mirror_bug.py
@@ -9,6 +9,14 @@ class Migration(SchemaMigration):
db.add_column(u'mirrors_mirror', 'bug',
self.gf('django.db.models.fields.PositiveIntegerField')(null=True),
keep_default=False)
+ # UPDATE mirrors_mirror m
+ # SET bug = (
+ # SELECT extracted::int FROM (
+ # SELECT id, substring(notes from 'FS#([\d]+)') AS extracted FROM mirrors_mirror
+ # ) a
+ # WHERE extracted IS NOT NULL AND a.id = m.id
+ # )
+ # WHERE notes LIKE '%FS#%';
def backwards(self, orm):
db.delete_column(u'mirrors_mirror', 'bug')