PageRenderTime 161ms CodeModel.GetById 80ms app.highlight 19ms RepoModel.GetById 52ms app.codeStats 0ms

/src/libtomahawk/database/Schema.sql.h

http://github.com/tomahawk-player/tomahawk
C Header | 208 lines | 201 code | 4 blank | 3 comment | 0 complexity | 3ec3ed084452706491d0d003c6caeaf4 MD5 | raw file
  1/*
  2    This file was automatically generated from ./Schema.sql on Tue Jul 30 12:51:06 CEST 2013.
  3*/
  4
  5static const char * tomahawk_schema_sql = 
  6"CREATE TABLE IF NOT EXISTS oplog ("
  7"    id INTEGER PRIMARY KEY AUTOINCREMENT,"
  8"    source INTEGER REFERENCES source(id) ON DELETE CASCADE ON UPDATE CASCADE, "
  9"    guid TEXT NOT NULL,"
 10"    command TEXT NOT NULL,"
 11"    singleton BOOLEAN NOT NULL,"
 12"    compressed BOOLEAN NOT NULL,"
 13"    json TEXT NOT NULL"
 14");"
 15"CREATE UNIQUE INDEX oplog_guid ON oplog(guid);"
 16"CREATE INDEX oplog_source ON oplog(source);"
 17"CREATE TABLE IF NOT EXISTS artist ("
 18"    id INTEGER PRIMARY KEY AUTOINCREMENT,"
 19"    name TEXT NOT NULL,"
 20"    sortname TEXT NOT NULL"
 21");"
 22"CREATE UNIQUE INDEX artist_sortname ON artist(sortname);"
 23"CREATE INDEX artist_name ON artist(name);"
 24"CREATE TABLE IF NOT EXISTS track ("
 25"    id INTEGER PRIMARY KEY AUTOINCREMENT,"
 26"    artist INTEGER NOT NULL REFERENCES artist(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
 27"    name TEXT NOT NULL,"
 28"    sortname TEXT NOT NULL"
 29");"
 30"CREATE UNIQUE INDEX track_artist_sortname ON track(artist,sortname);"
 31"CREATE INDEX track_name ON track(name);"
 32"CREATE TABLE IF NOT EXISTS album ("
 33"    id INTEGER PRIMARY KEY AUTOINCREMENT,"
 34"    artist INTEGER NOT NULL REFERENCES artist(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
 35"    name TEXT NOT NULL,"
 36"    sortname TEXT NOT NULL"
 37");"
 38"CREATE UNIQUE INDEX album_artist_sortname ON album(artist,sortname);"
 39"CREATE TABLE IF NOT EXISTS source ("
 40"    id INTEGER PRIMARY KEY AUTOINCREMENT,"
 41"    name TEXT NOT NULL,"
 42"    friendlyname TEXT,"
 43"    lastop TEXT NOT NULL DEFAULT \"\",       "
 44"    isonline BOOLEAN NOT NULL DEFAULT false"
 45");"
 46"CREATE UNIQUE INDEX source_name ON source(name);"
 47"CREATE TABLE IF NOT EXISTS playlist ("
 48"    guid TEXT PRIMARY KEY,"
 49"    source INTEGER REFERENCES source(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED, "
 50"    shared BOOLEAN DEFAULT false,"
 51"    title TEXT,"
 52"    info TEXT,"
 53"    creator TEXT,"
 54"    lastmodified INTEGER NOT NULL DEFAULT 0,"
 55"    currentrevision TEXT REFERENCES playlist_revision(guid) DEFERRABLE INITIALLY DEFERRED,"
 56"    dynplaylist BOOLEAN DEFAULT false,"
 57"    createdOn INTEGER NOT NULL DEFAULT 0"
 58");"
 59"CREATE TABLE IF NOT EXISTS playlist_item ("
 60"    guid TEXT PRIMARY KEY,"
 61"    playlist TEXT NOT NULL REFERENCES playlist(guid) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
 62"    trackname  TEXT NOT NULL,"
 63"    artistname TEXT NOT NULL,"
 64"    albumname  TEXT,"
 65"    annotation TEXT,"
 66"    duration INTEGER,       "
 67"    addedon INTEGER NOT NULL DEFAULT 0,   "
 68"    addedby INTEGER REFERENCES source(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED, "
 69"    result_hint TEXT        "
 70");"
 71"CREATE INDEX playlist_item_playlist ON playlist_item(playlist);"
 72"CREATE INDEX playlist_item_trackname ON playlist_item(trackname);"
 73"CREATE INDEX playlist_item_artistname ON playlist_item(artistname);"
 74"CREATE TABLE IF NOT EXISTS playlist_revision ("
 75"    guid TEXT PRIMARY KEY,"
 76"    playlist TEXT NOT NULL REFERENCES playlist(guid) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
 77"    entries TEXT, "
 78"    author INTEGER REFERENCES source(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
 79"    timestamp INTEGER NOT NULL DEFAULT 0,"
 80"    previous_revision TEXT REFERENCES playlist_revision(guid) DEFERRABLE INITIALLY DEFERRED"
 81");"
 82"CREATE TABLE IF NOT EXISTS dynamic_playlist ("
 83"    guid TEXT NOT NULL REFERENCES playlist(guid) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
 84"    pltype TEXT, "
 85"    plmode INTEGER, "
 86"    autoload BOOLEAN DEFAULT true "
 87");"
 88"CREATE TABLE IF NOT EXISTS dynamic_playlist_controls ("
 89"    id TEXT PRIMARY KEY,"
 90"    playlist TEXT NOT NULL REFERENCES playlist(guid) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
 91"    selectedType TEXT,"
 92"    match TEXT,"
 93"    input TEXT"
 94");"
 95"CREATE TABLE IF NOT EXISTS dynamic_playlist_revision ("
 96"    guid TEXT PRIMARY KEY NOT NULL REFERENCES playlist_revision(guid) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
 97"    controls TEXT, "
 98"    plmode INTEGER,"
 99"    pltype TEXT"
100");"
101"CREATE TABLE IF NOT EXISTS file ("
102"    id INTEGER PRIMARY KEY AUTOINCREMENT,"
103"    source INTEGER REFERENCES source(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
104"    url TEXT NOT NULL,                   "
105"    size INTEGER NOT NULL,               "
106"    mtime INTEGER NOT NULL,              "
107"    md5 TEXT,                            "
108"    mimetype TEXT,                       "
109"    duration INTEGER NOT NULL DEFAULT 0, "
110"    bitrate INTEGER NOT NULL DEFAULT 0   "
111");"
112"CREATE UNIQUE INDEX file_url_src_uniq ON file(source, url);"
113"CREATE INDEX file_source ON file(source);"
114"CREATE INDEX file_mtime ON file(mtime);"
115"CREATE TABLE IF NOT EXISTS dirs_scanned ("
116"    name TEXT PRIMARY KEY,"
117"    mtime INTEGER NOT NULL"
118");"
119"CREATE TABLE IF NOT EXISTS file_join ("
120"    file INTEGER PRIMARY KEY REFERENCES file(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
121"    artist INTEGER NOT NULL REFERENCES artist(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
122"    track INTEGER NOT NULL REFERENCES track(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
123"    album INTEGER REFERENCES album(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
124"    albumpos INTEGER,"
125"    composer INTEGER REFERENCES artist(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
126"    discnumber INTEGER"
127");"
128"CREATE INDEX file_join_track  ON file_join(track);"
129"CREATE INDEX file_join_artist ON file_join(artist);"
130"CREATE INDEX file_join_album  ON file_join(album);"
131"CREATE TABLE IF NOT EXISTS track_tags ("
132"    id INTEGER PRIMARY KEY,   "
133"    source INTEGER REFERENCES source(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
134"    tag TEXT NOT NULL,        "
135"    ns TEXT,                  "
136"    weight float DEFAULT 1.0  "
137");"
138"CREATE INDEX track_tags_tag ON track_tags(tag);"
139"CREATE TABLE IF NOT EXISTS album_tags ("
140"    id INTEGER PRIMARY KEY,   "
141"    source INTEGER REFERENCES source(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
142"    tag TEXT NOT NULL,        "
143"    ns TEXT,                  "
144"    weight float DEFAULT 1.0  "
145");"
146"CREATE INDEX album_tags_tag ON album_tags(tag);"
147"CREATE TABLE IF NOT EXISTS artist_tags ("
148"    id INTEGER PRIMARY KEY,   "
149"    source INTEGER REFERENCES source(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
150"    tag TEXT NOT NULL,        "
151"    ns TEXT,                  "
152"    weight float DEFAULT 1.0  "
153");"
154"CREATE INDEX artist_tags_tag ON artist_tags(tag);"
155"CREATE TABLE IF NOT EXISTS track_attributes ("
156"    id INTEGER REFERENCES track(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,   "
157"    k TEXT NOT NULL,"
158"    v TEXT NOT NULL"
159");"
160"CREATE INDEX track_attrib_id ON track_attributes(id);"
161"CREATE INDEX track_attrib_k  ON track_attributes(k);"
162"CREATE TABLE IF NOT EXISTS collection_attributes ("
163"    id INTEGER REFERENCES source(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED, "
164"    k TEXT NOT NULL,"
165"    v TEXT NOT NULL"
166");"
167"CREATE TABLE IF NOT EXISTS social_attributes ("
168"    id INTEGER REFERENCES track(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,   "
169"    source INTEGER REFERENCES source(id) ON DELETE CASCADE ON UPDATE CASCADE, "
170"    k TEXT NOT NULL,"
171"    v TEXT NOT NULL,"
172"    timestamp INTEGER NOT NULL DEFAULT 0"
173");"
174"CREATE INDEX social_attrib_id        ON social_attributes(id);"
175"CREATE INDEX social_attrib_source    ON social_attributes(source);"
176"CREATE INDEX social_attrib_k         ON social_attributes(k);"
177"CREATE INDEX social_attrib_timestamp ON social_attributes(timestamp);"
178"CREATE TABLE IF NOT EXISTS playback_log ("
179"    id INTEGER PRIMARY KEY AUTOINCREMENT,"
180"    source INTEGER REFERENCES source(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
181"    track INTEGER REFERENCES track(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,"
182"    playtime INTEGER NOT NULL,              "
183"    secs_played INTEGER NOT NULL"
184");"
185"CREATE INDEX playback_log_source ON playback_log(source);"
186"CREATE INDEX playback_log_track ON playback_log(track);"
187"CREATE INDEX playback_log_playtime ON playback_log(playtime);"
188"CREATE TABLE IF NOT EXISTS http_client_auth ("
189"    token TEXT NOT NULL PRIMARY KEY,"
190"    website TEXT NOT NULL,"
191"    name TEXT NOT NULL,"
192"    ua TEXT,"
193"    mtime INTEGER,"
194"    permissions TEXT NOT NULL"
195");"
196"CREATE TABLE IF NOT EXISTS settings ("
197"    k TEXT NOT NULL PRIMARY KEY,"
198"    v TEXT NOT NULL DEFAULT ''"
199");"
200"INSERT INTO settings(k,v) VALUES('schema_version', '31');"
201    ;
202
203const char * get_tomahawk_sql()
204{
205    return tomahawk_schema_sql;
206}
207
208