Commit 5b4b3e91 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Task: Split table creation in a specific file

parent 71e5bcf1
......@@ -359,6 +359,7 @@ EXTRA_DIST += medialibrary.pc \
src/database/tables/Playlist_triggers_v14.sql \
src/database/tables/Metadata_v14.sql \
src/database/tables/Device_v14.sql \
src/database/tables/Task_v14.sql \
$(NULL)
......
"CREATE TABLE IF NOT EXISTS " + Task::Table::Name +
"("
"id_task INTEGER PRIMARY KEY AUTOINCREMENT,"
"step INTEGER NOT NULL DEFAULT 0,"
"retry_count INTEGER NOT NULL DEFAULT 0,"
"mrl TEXT,"
"file_id UNSIGNED INTEGER,"
"parent_folder_id UNSIGNED INTEGER,"
"parent_playlist_id INTEGER,"
"parent_playlist_index UNSIGNED INTEGER,"
"UNIQUE(mrl, parent_playlist_id) ON CONFLICT FAIL,"
"FOREIGN KEY (parent_folder_id) REFERENCES " + Folder::Table::Name
+ "(id_folder) ON DELETE CASCADE,"
"FOREIGN KEY (file_id) REFERENCES " + File::Table::Name
+ "(id_file) ON DELETE CASCADE,"
"FOREIGN KEY (parent_playlist_id) REFERENCES " + Playlist::Table::Name
+ "(id_playlist) ON DELETE CASCADE"
")",
......@@ -416,24 +416,11 @@ void Task::setMrl( std::string newMrl )
void Task::createTable( sqlite::Connection* dbConnection )
{
std::string req = "CREATE TABLE IF NOT EXISTS " + Task::Table::Name + "("
"id_task INTEGER PRIMARY KEY AUTOINCREMENT,"
"step INTEGER NOT NULL DEFAULT 0,"
"retry_count INTEGER NOT NULL DEFAULT 0,"
"mrl TEXT,"
"file_id UNSIGNED INTEGER,"
"parent_folder_id UNSIGNED INTEGER,"
"parent_playlist_id INTEGER,"
"parent_playlist_index UNSIGNED INTEGER,"
"UNIQUE(mrl, parent_playlist_id) ON CONFLICT FAIL,"
"FOREIGN KEY (parent_folder_id) REFERENCES " + Folder::Table::Name
+ "(id_folder) ON DELETE CASCADE,"
"FOREIGN KEY (file_id) REFERENCES " + File::Table::Name
+ "(id_file) ON DELETE CASCADE,"
"FOREIGN KEY (parent_playlist_id) REFERENCES " + Playlist::Table::Name
+ "(id_playlist) ON DELETE CASCADE"
")";
sqlite::Tools::executeRequest( dbConnection, req );
std::string reqs[] = {
#include "database/tables/Task_v14.sql"
};
for ( const auto& req : reqs )
sqlite::Tools::executeRequest( dbConnection, req );
}
void Task::resetRetryCount( MediaLibraryPtr ml )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment