Media_v14.sql 1.04 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
"CREATE TABLE IF NOT EXISTS " + policy::MediaTable::Name + "("
    "id_media INTEGER PRIMARY KEY AUTOINCREMENT,"
    "type INTEGER,"
    "subtype INTEGER NOT NULL DEFAULT " +
        std::to_string( static_cast<typename std::underlying_type<IMedia::SubType>::type>(
                            IMedia::SubType::Unknown ) ) + ","
    "duration INTEGER DEFAULT -1,"
    "play_count UNSIGNED INTEGER,"
    "last_played_date UNSIGNED INTEGER,"
    "insertion_date UNSIGNED INTEGER,"
    "release_date UNSIGNED INTEGER,"
    "thumbnail_id INTEGER,"
    "thumbnail_generated BOOLEAN NOT NULL DEFAULT 0,"
    "title TEXT COLLATE NOCASE,"
    "filename TEXT,"
    "is_favorite BOOLEAN NOT NULL DEFAULT 0,"
    "is_present BOOLEAN NOT NULL DEFAULT 1,"

    "FOREIGN KEY(thumbnail_id) REFERENCES " + policy::ThumbnailTable::Name
    + "(id_thumbnail)"
")",

23 24 25
"CREATE INDEX IF NOT EXISTS media_types_idx ON " + policy::MediaTable::Name +
    "(type, subtype)",

26 27 28 29
"CREATE VIRTUAL TABLE IF NOT EXISTS "
    + policy::MediaTable::Name + "Fts USING FTS3("
    "title,"
    "labels"
30
")",