1 def migrate_up(manager): 2 manager.execute_script(ADD_COLUMNS) 3 4 def migrate_down(manager): 5 manager.execute_script(DROP_COLUMNS) 6 7 ADD_COLUMNS = """\ 8 DELETE FROM embedded_graphing_queries; 9 10 ALTER TABLE embedded_graphing_queries 11 DROP COLUMN last_accessed; 12 13 ALTER TABLE embedded_graphing_queries 14 ADD COLUMN ( 15 last_updated DATETIME NOT NULL, 16 refresh_time DATETIME DEFAULT NULL, 17 cached_png MEDIUMBLOB 18 ); 19 """ 20 21 DROP_COLUMNS = """\ 22 ALTER TABLE embedded_graphing_queries 23 DROP COLUMN last_updated; 24 25 ALTER TABLE embedded_graphing_queries 26 DROP COLUMN cached_png; 27 28 ALTER TABLE embedded_graphing_queries 29 DROP COLUMN refresh_time; 30 31 ALTER TABLE embedded_graphing_queries 32 ADD COLUMN (last_accessed DATETIME NOT NULL); 33 """ 34