misc: migrate dashboard/tile foreign keys (#...)
This commit is contained in:
parent
85cf3e767f
commit
e626863893
|
@ -0,0 +1,29 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('dashboard', '0005_auto_20180107_1355'),
|
||||
('data', '0033_auto_20180107_1259'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunSQL("""
|
||||
UPDATE dashboard_tile SET dashboard_id =
|
||||
(SELECT data_cellbase.id
|
||||
FROM data_cellbase
|
||||
WHERE data_cellbase.subclassid = dashboard_tile.dashboard_id
|
||||
AND data_cellbase.subclass = 13);"""),
|
||||
# this assumes tile cells are always of type "configjsoncell", this is
|
||||
# not theorically true but it's close enough to the current truth.
|
||||
migrations.RunSQL("""
|
||||
UPDATE dashboard_tile SET cell_pk =
|
||||
(SELECT data_cellbase.id
|
||||
FROM data_cellbase
|
||||
WHERE data_cellbase.subclassid = dashboard_tile.cell_pk
|
||||
AND data_cellbase.subclass = 2);"""),
|
||||
]
|
Loading…
Reference in New Issue