Statements:[]string{"DROP INDEX IF EXISTS idx_albums_album_filter ON albums;","ALTER TABLE albums MODIFY album_filter VARBINARY(2048) DEFAULT '';","CREATE OR REPLACE INDEX idx_albums_album_filter ON albums (album_filter(512));"},
Statements:[]string{"CREATE OR REPLACE INDEX idx_files_photo_id ON files (photo_id, file_primary);"},
},
{
ID:"20220329-070000",
Dialect:"mysql",
Statements:[]string{"ALTER TABLE files MODIFY COLUMN IF EXISTS photo_taken_at DATETIME AFTER photo_uid;","ALTER TABLE files ADD COLUMN IF NOT EXISTS photo_taken_at DATETIME AFTER photo_uid;"},
},
{
ID:"20220329-071000",
Dialect:"mysql",
Statements:[]string{"UPDATE files f JOIN photos p ON p.id = f.photo_id SET f.photo_taken_at = p.taken_at_local;"},
},
{
ID:"20220329-080000",
Dialect:"mysql",
Statements:[]string{"ALTER TABLE files MODIFY IF EXISTS media_id VARBINARY(32) AFTER photo_taken_at;","ALTER TABLE files ADD IF NOT EXISTS media_id VARBINARY(32) AFTER photo_taken_at;"},
},
{
ID:"20220329-081000",
Dialect:"mysql",
Statements:[]string{"CREATE OR REPLACE UNIQUE INDEX idx_files_search_media ON files (media_id);"},
Statements:[]string{"UPDATE files SET media_id = CASE WHEN file_missing = 0 AND deleted_at IS NULL THEN CONCAT((10000000000 - photo_id), '-', 1 + file_sidecar - file_primary, '-', file_uid) END;"},
Statements:[]string{"ALTER TABLE files MODIFY IF EXISTS time_index VARBINARY(64) AFTER photo_taken_at;","ALTER TABLE files ADD IF NOT EXISTS time_index VARBINARY(64) AFTER photo_taken_at;"},
Statements:[]string{"UPDATE files SET time_index = CASE WHEN file_missing = 0 AND deleted_at IS NULL THEN CONCAT(100000000000000 - CAST(photo_taken_at AS UNSIGNED), '-', media_id) END;"},
Statements:[]string{"REPLACE INTO auth_users_dev (id, user_uid, super_admin, can_login, can_sync, user_role, display_name, user_name, user_email, login_at, created_at, updated_at) SELECT id, user_uid, role_admin, 1, 1, 'admin', full_name, user_name, primary_email, login_at, created_at, updated_at FROM users WHERE role_admin = 1 AND user_name NOT IN (SELECT user_name FROM auth_users) AND user_name <> '' AND user_name IS NOT NULL;"},