diff --git a/db/migrations/mysql/20230627162519_add_plex_columns.php b/db/migrations/mysql/20230627162519_AddPlexOAuthColumnsToUserTable.php similarity index 94% rename from db/migrations/mysql/20230627162519_add_plex_columns.php rename to db/migrations/mysql/20230627162519_AddPlexOAuthColumnsToUserTable.php index 07bc51a5..68441312 100644 --- a/db/migrations/mysql/20230627162519_add_plex_columns.php +++ b/db/migrations/mysql/20230627162519_AddPlexOAuthColumnsToUserTable.php @@ -2,7 +2,7 @@ use Phinx\Migration\AbstractMigration; -final class AddPlexColumns extends AbstractMigration +final class AddPlexOAuthColumnsToUserTable extends AbstractMigration { public function down() : void { @@ -29,4 +29,4 @@ public function up() : void SQL, ); } -} \ No newline at end of file +} diff --git a/db/migrations/sqlite/20230627162519_AddPlexColumns.php b/db/migrations/sqlite/20230627162519_AddPlexColumns.php index 35831bbc..a9e5311a 100644 --- a/db/migrations/sqlite/20230627162519_AddPlexColumns.php +++ b/db/migrations/sqlite/20230627162519_AddPlexColumns.php @@ -13,24 +13,79 @@ public function down() : void `email` TEXT NOT NULL, `name` TEXT NOT NULL, `password` TEXT NOT NULL , + `is_admin` TINYINT(1) DEFAULT 0, + `dashboard_visible_rows` TEXT DEFAULT NULL, + `dashboard_extended_rows` TEXT DEFAULT NULL, + `dashboard_order_rows` TEXT DEFAULT NULL, `privacy_level` INTEGER DEFAULT 1, `date_format_id` INTEGER DEFAULT 0, `trakt_user_name` TEXT, `plex_webhook_uuid` TEXT, `jellyfin_webhook_uuid` TEXT, + `emby_webhook_uuid` TEXT, `trakt_client_id` TEXT, `jellyfin_scrobble_views` INTEGER DEFAULT 1, + `emby_scrobble_views` INTEGER DEFAULT 1, `plex_scrobble_views` INTEGER DEFAULT 1, `plex_scrobble_ratings` INTEGER DEFAULT 0, + `watchlist_automatic_removal_enabled` INTEGER DEFAULT 0, `core_account_changes_disabled` INTEGER DEFAULT 0, `created_at` TEXT NOT NULL, PRIMARY KEY (`id`), UNIQUE (`email`), - UNIQUE (`name`) + UNIQUE (`name`) ) SQL, ); - $this->execute('INSERT INTO `tmp_user` (id, email, name, password, privacy_level, date_format_id, trakt_user_name, plex_webhook_uuid, jellyfin_webhook_uuid, trakt_client_id, jellyfin_scrobble_views, plex_scrobble_views, plex_scrobble_ratings, core_account_changes_disabled, created_at) SELECT `id`, `email`, `name`, `password`, `privacy_level`, `date_format_id`, `trakt_user_name`, `plex_webhook_uuid`, `jellyfin_webhook_uuid`, `trakt_client_id`, `jellyfin_scrobble_views`, `plex_scrobble_views`, `plex_scrobble_ratings`, `core_account_changes_disabled`, `created_at` FROM user'); + + $this->execute( + 'INSERT INTO `tmp_user` ( + `id`, + `email`, + `name`, + `password`, + `is_admin`, + `dashboard_visible_rows`, + `dashboard_extended_rows`, + `dashboard_order_rows`, + `privacy_level`, + `date_format_id`, + `trakt_user_name`, + `plex_webhook_uuid`, + `jellyfin_webhook_uuid`, + `emby_webhook_uuid`, + `trakt_client_id`, + `jellyfin_scrobble_views`, + `emby_scrobble_views`, + `plex_scrobble_views`, + `plex_scrobble_ratings`, + `watchlist_automatic_removal_enabled`, + `core_account_changes_disabled`, + `created_at` + ) SELECT + `id`, + `email`, + `name`, + `password`, + `is_admin`, + `dashboard_visible_rows`, + `dashboard_extended_rows`, + `dashboard_order_rows`, + `privacy_level`, + `date_format_id`, + `trakt_user_name`, + `plex_webhook_uuid`, + `jellyfin_webhook_uuid`, + `emby_webhook_uuid`, + `trakt_client_id`, + `jellyfin_scrobble_views`, + `emby_scrobble_views`, + `plex_scrobble_views`, + `plex_scrobble_ratings`, + `watchlist_automatic_removal_enabled`, + `core_account_changes_disabled`, + `created_at` FROM user', + ); $this->execute('DROP TABLE `user`'); $this->execute('ALTER TABLE `tmp_user` RENAME TO `user`'); } @@ -44,30 +99,62 @@ public function up() : void `email` TEXT NOT NULL, `name` TEXT NOT NULL, `password` TEXT NOT NULL , + `is_admin` TINYINT(1) DEFAULT 0, + `dashboard_visible_rows` TEXT DEFAULT NULL, + `dashboard_extended_rows` TEXT DEFAULT NULL, + `dashboard_order_rows` TEXT DEFAULT NULL, `privacy_level` INTEGER DEFAULT 1, `date_format_id` INTEGER DEFAULT 0, `trakt_user_name` TEXT, `plex_webhook_uuid` TEXT, `jellyfin_webhook_uuid` TEXT, + `emby_webhook_uuid` TEXT, `trakt_client_id` TEXT, - `jellyfin_scrobble_views` INTEGER DEFAULT 1, - `plex_scrobble_views` INTEGER DEFAULT 1, - `plex_scrobble_ratings` INTEGER DEFAULT 0, `plex_client_id` TEXT DEFAULT NULL, `plex_client_temporary_code` TEXT DEFAULT NULL, `plex_access_token` TEXT DEFAULT NULL, `plex_account_id` TEXT DEFAULT NULL, `plex_server_url` TEXT DEFAULT NULL, + `jellyfin_scrobble_views` INTEGER DEFAULT 1, + `emby_scrobble_views` INTEGER DEFAULT 1, + `plex_scrobble_views` INTEGER DEFAULT 1, + `plex_scrobble_ratings` INTEGER DEFAULT 0, + `watchlist_automatic_removal_enabled` INTEGER DEFAULT 0, `core_account_changes_disabled` INTEGER DEFAULT 0, `created_at` TEXT NOT NULL, PRIMARY KEY (`id`), UNIQUE (`email`), - UNIQUE (`name`) + UNIQUE (`name`) ) SQL, ); - $this->execute('INSERT INTO `tmp_user` (id, email, name, password, privacy_level, date_format_id, trakt_user_name, plex_webhook_uuid, jellyfin_webhook_uuid, trakt_client_id, jellyfin_scrobble_views, plex_scrobble_views, plex_scrobble_ratings, core_account_changes_disabled, created_at) SELECT * FROM user'); + $this->execute( + 'INSERT INTO `tmp_user` ( + `id`, + `email`, + `name`, + `password`, + `is_admin`, + `dashboard_visible_rows`, + `dashboard_extended_rows`, + `dashboard_order_rows`, + `privacy_level`, + `date_format_id`, + `trakt_user_name`, + `plex_webhook_uuid`, + `jellyfin_webhook_uuid`, + `emby_webhook_uuid`, + `trakt_client_id`, + `jellyfin_scrobble_views`, + `emby_scrobble_views`, + `plex_scrobble_views`, + `plex_scrobble_ratings`, + `watchlist_automatic_removal_enabled`, + `core_account_changes_disabled`, + `created_at` + ) SELECT * FROM user', + ); $this->execute('DROP TABLE `user`'); $this->execute('ALTER TABLE `tmp_user` RENAME TO `user`'); } -} \ No newline at end of file +}