root/trunk/sql/setupdb-sqlite.sql

Revision 787, 1.3 kB (checked in by nicfit, 1 year ago)

Added to artists: date_added
Added to albums: date_added
Added to tracks table: track_num, track_total, time_secs, size_bytes, data_added
Added tags and tracks_tags tables

Line 
1 CREATE TABLE artists (
2    sync       BOOLEAN,
3 );
4
5 CREATE TABLE albums (
6    sync         BOOLEAN,
7    small_cover  VARCHAR(255) UNIQUE,
8    medium_cover VARCHAR(255) UNIQUE,
9    large_cover  VARCHAR(255) UNIQUE,
10    compilation  BOOLEAN NOT NULL
11 );
12
13 CREATE TABLE tracks (
14    sync         BOOLEAN,
15    bitrate      SMALLINT UNSIGNED NOT NULL,
16    vbr          BOOLEAN,
17    sample_freq  MEDIUMINT UNSIGNED NOT NULL,
18    mode         VARCHAR(30),
19    audio_type   VARCHAR(3),
20    tag_version  VARCHAR(15),
21    play_count   INT UNSIGNED NOT NULL,
22    play_date    TIMESTAMP,
23    genre_id     TINYINT UNSIGNED REFERENCES genres(id),
24    year         YEAR(4),
25    mod_time     INTEGER UNSIGNED NOT NULL
26 );
27
28 CREATE TABLE playlists (
29    id            INTEGER PRIMARY KEY,
30    name          VARCHAR(64) NOT NULL UNIQUE,
31    current_track INTEGER UNSIGNED NOT NULL
32 );
33 INSERT INTO playlists VALUES (0, "Playlist", 0);
34
35 CREATE TABLE playlist_tracks (
36    pid INTEGER UNSIGNED NOT NULL REFERENCES playlists(id),
37    tid INTEGER UNSIGNED NOT NULL REFERENCES tracks(id)
38 );
39
40 CREATE TABLE meta_data (
41    sync_timestamp TIMESTAMP NOT NULL UNIQUE,
42    archive_size   VARCHAR(20),
43    artist_count   INTEGER UNSIGNED NOT NULL DEFAULT 0,
44    album_count    INTEGER UNSIGNED NOT NULL DEFAULT 0,
45    track_count    INTEGER UNSIGNED NOT NULL DEFAULT 0,
46    total_time     INTEGER UNSIGNED NOT NULL DEFAULT 0
47 );
Note: See TracBrowser for help on using the browser.