defuze.me  Client
scheduler_migration.cpp
00001 #include "migration_list.hpp"
00002 
00003 using namespace DB;
00004 
00005 void    SchedulerMigration::up()
00006 {
00007     createTable("events", "id INTEGER PRIMARY KEY, title VARCHAR(255), description VARCHAR(255), day INTEGER, start INTEGER, duration INTEGER");
00008     exec("CREATE UNIQUE INDEX event_id ON events(id)");
00009 
00010     createTable("colors", "id INTEGER PRIMARY KEY, color VARCHAR(6)");
00011     exec("CREATE UNIQUE INDEX color_id ON colors(id)");
00012 
00013     createTable("colors_events", "event_id INTEGER PRIMARY KEY, color_id INTEGER");
00014     exec("CREATE UNIQUE INDEX color_event_id ON colors_events(event_id)");
00015 
00016     createTable("events_playlists", "id INTEGER PRIMARY KEY, event_id INTEGER, playlist_id INTEGER");
00017     exec("CREATE UNIQUE INDEX event_playlist_id ON events_playlists(id)");
00018 
00019     exec("insert into colors values('1', 'FFAD46')");
00020     exec("insert into colors values('2', 'A4BDFC')");
00021     exec("insert into colors values('3', '7AE7BF')");
00022     exec("insert into colors values('4', 'DBADFF')");
00023     exec("insert into colors values('5', 'FF887C')");
00024     exec("insert into colors values('6', 'FBD75B')");
00025     exec("insert into colors values('7', 'FFB878')");
00026     exec("insert into colors values('8', '46D6DB')");
00027     exec("insert into colors values('9', 'E1E1E1')");
00028 }
00029 
00030 void    SchedulerMigration::down()
00031 {
00032     dropTable("colors");
00033     dropTable("events");
00034     dropTable("colors_events");
00035     dropTable("events_playlists");
00036 }