[db-upgrade] add column date_released to files table, add column name to

speakers table
This commit is contained in:
chme 2016-01-29 19:46:56 +01:00
parent dcfec5c1d4
commit 8600c21424
3 changed files with 14 additions and 2 deletions

View File

@ -138,6 +138,7 @@ static const struct col_type_map mfi_cols_map[] =
{ mfi_offsetof(album_artist_sort), DB_TYPE_STRING },
{ mfi_offsetof(virtual_path), DB_TYPE_STRING },
{ mfi_offsetof(directory_id), DB_TYPE_INT },
{ mfi_offsetof(date_released), DB_TYPE_INT },
};
/* This list must be kept in sync with
@ -227,6 +228,7 @@ static const ssize_t dbmfi_cols_map[] =
dbmfi_offsetof(album_artist_sort),
dbmfi_offsetof(virtual_path),
dbmfi_offsetof(directory_id),
dbmfi_offsetof(date_released),
};
/* This list must be kept in sync with
@ -4850,7 +4852,8 @@ db_perthread_deinit(void)
" composer_sort VARCHAR(1024) DEFAULT NULL COLLATE DAAP," \
" album_artist_sort VARCHAR(1024) DEFAULT NULL COLLATE DAAP," \
" virtual_path VARCHAR(4096) DEFAULT NULL," \
" directory_id INTEGER DEFAULT 0" \
" directory_id INTEGER DEFAULT 0," \
" date_released INTEGER DEFAULT 0" \
");"
#define T_PL \
@ -4896,7 +4899,8 @@ db_perthread_deinit(void)
"CREATE TABLE IF NOT EXISTS speakers(" \
" id INTEGER PRIMARY KEY NOT NULL," \
" selected INTEGER NOT NULL," \
" volume INTEGER NOT NULL" \
" volume INTEGER NOT NULL," \
" name VARCHAR(255) DEFAULT NULL" \
");"
#define T_INOTIFY \

View File

@ -184,6 +184,7 @@ struct media_file_info {
char *virtual_path;
uint32_t directory_id; /* Id of directory */
uint32_t date_released;
};
#define mfi_offsetof(field) offsetof(struct media_file_info, field)
@ -321,6 +322,7 @@ struct db_media_file_info {
char *album_artist_sort;
char *virtual_path;
char *directory_id;
char *date_released;
};
#define dbmfi_offsetof(field) offsetof(struct db_media_file_info, field)

View File

@ -1186,6 +1186,10 @@ static const struct db_upgrade_query db_upgrade_v1801_queries[] =
"ALTER TABLE playlists ADD COLUMN directory_id INTEGER DEFAULT 0;"
#define U_V1900_ALTER_FILES_ADD_DIRECTORYID \
"ALTER TABLE files ADD COLUMN directory_id INTEGER DEFAULT 0;"
#define U_V1900_ALTER_FILES_ADD_DATERELEASED \
"ALTER TABLE files ADD COLUMN date_released INTEGER DEFAULT 0;"
#define U_V1900_ALTER_SPEAKERS_ADD_NAME \
"ALTER TABLE speakers ADD COLUMN name VARCHAR(255) DEFAULT NULL;"
#define U_V1900_INSERT_DIR1 \
"INSERT INTO directories (id, virtual_path, db_timestamp, disabled, parent_id)" \
@ -1210,6 +1214,8 @@ static const struct db_upgrade_query db_upgrade_v1900_queries[] =
{ U_V1900_CREATE_TABLE_DIRECTORIES, "create table directories" },
{ U_V1900_ALTER_PL_ADD_DIRECTORYID, "alter table pl add column directory_id" },
{ U_V1900_ALTER_FILES_ADD_DIRECTORYID, "alter table files add column directory_id" },
{ U_V1900_ALTER_FILES_ADD_DATERELEASED,"alter table files add column date_released" },
{ U_V1900_ALTER_SPEAKERS_ADD_NAME, "alter table speakers add column name" },
{ U_V1900_INSERT_DIR1, "insert root directory" },
{ U_V1900_INSERT_DIR2, "insert /file: directory" },
{ U_V1900_INSERT_DIR3, "insert /htttp: directory" },