mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 01:25:16 +00:00
Migratino to set Widget.type and Widget.query_id to nullables
This commit is contained in:
parent
704f2c176d
commit
93fe613a9a
13
migrations/change_query_id_on_widgets_to_null.py
Normal file
13
migrations/change_query_id_on_widgets_to_null.py
Normal file
@ -0,0 +1,13 @@
|
||||
from playhouse.migrate import Migrator
|
||||
from redash import db
|
||||
from redash import models
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
db.connect_db()
|
||||
migrator = Migrator(db.database)
|
||||
with db.database.transaction():
|
||||
migrator.set_nullable(models.Widget, models.Widget.query_id, True)
|
||||
migrator.set_nullable(models.Widget, models.Widget.type, True)
|
||||
|
||||
db.close_db(None)
|
@ -212,12 +212,16 @@ class Visualization(BaseModel):
|
||||
class Widget(db.Model):
|
||||
id = peewee.PrimaryKeyField()
|
||||
visualization = peewee.ForeignKeyField(Visualization, related_name='widgets')
|
||||
type = peewee.CharField(max_length=100, null=True) # unused; kept for backward compatability
|
||||
|
||||
width = peewee.IntegerField()
|
||||
options = peewee.TextField()
|
||||
dashboard = peewee.ForeignKeyField(Dashboard, related_name='widgets', index=True)
|
||||
created_at = peewee.DateTimeField(default=datetime.datetime.now)
|
||||
|
||||
# unused; kept for backward compatability:
|
||||
type = peewee.CharField(max_length=100, null=True)
|
||||
query_id = peewee.IntegerField(null=True)
|
||||
|
||||
class Meta:
|
||||
db_table = 'widgets'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user