defuze.me  Client
audio_tracks_migration.cpp
00001 /**************************************************************************
00002 ** defuze.me Epitech Innovative Project
00003 **
00004 ** Copyright 2010-2011
00005 **   Athena Calmettes - Jocelyn De La Rosa - Francois Gaillard
00006 **   Adrien Jarthon - Alexandre Moore - Luc Peres - Arnaud Sellier
00007 **
00008 ** All rights reserved.
00009 **************************************************************************/
00010 
00011 #include "migration_list.hpp"
00012 #include "jsonparser.hpp"
00013 
00014 using namespace DB;
00015 
00016 void    AudioTracksMigration::up()
00017 {
00018     createTable("audio_tracks", "id integer primary key, title varchar(100) collate nocase, artist varchar(100) collate nocase, album_artist valchar(100) collate nocase, album varchar(100) collate nocase, year integer, track integer, genre varchar(50) collate nocase, duration integer, path varchar(1000), source integer, attributes text");
00019     exec("CREATE UNIQUE INDEX audio_track_id ON audio_tracks(id)");
00020     createTable("queue", "queueable_id integer, queueable_type varchar(20), position integer UNIQUE, attributes text");
00021     exec("CREATE INDEX queue_position ON queue(position)");
00022 }
00023 
00024 void    AudioTracksMigration::down()
00025 {
00026     dropTable("queue");
00027     dropTable("audio_tracks");
00028 }