From c85e774948a65b93b34da3f7eae9863eea786a83 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Tue, 5 Mar 2024 03:36:58 -0500 Subject: [PATCH] migration for user feature flags --- .../down.sql | 5 +++++ .../up.sql | 7 +++++++ _sql/migrations_squashed/user_tables/users.sql | 12 ++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 _sql/migrations/2024-03-05-082026_alter_users_add_feature_flags/down.sql create mode 100644 _sql/migrations/2024-03-05-082026_alter_users_add_feature_flags/up.sql diff --git a/_sql/migrations/2024-03-05-082026_alter_users_add_feature_flags/down.sql b/_sql/migrations/2024-03-05-082026_alter_users_add_feature_flags/down.sql new file mode 100644 index 0000000000..7a1e189e08 --- /dev/null +++ b/_sql/migrations/2024-03-05-082026_alter_users_add_feature_flags/down.sql @@ -0,0 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile +-- noinspection SqlResolveForFile + +ALTER TABLE users DROP COLUMN maybe_feature_flags; diff --git a/_sql/migrations/2024-03-05-082026_alter_users_add_feature_flags/up.sql b/_sql/migrations/2024-03-05-082026_alter_users_add_feature_flags/up.sql new file mode 100644 index 0000000000..bc3b2a0abc --- /dev/null +++ b/_sql/migrations/2024-03-05-082026_alter_users_add_feature_flags/up.sql @@ -0,0 +1,7 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile +-- noinspection SqlResolveForFile + +ALTER TABLE users + ADD COLUMN maybe_feature_flags VARCHAR(255) DEFAULT NULL + AFTER user_role_slug; diff --git a/_sql/migrations_squashed/user_tables/users.sql b/_sql/migrations_squashed/user_tables/users.sql index 0969d89844..d99f9e4d73 100644 --- a/_sql/migrations_squashed/user_tables/users.sql +++ b/_sql/migrations_squashed/user_tables/users.sql @@ -22,6 +22,18 @@ CREATE TABLE users ( -- The role assigned to the user confers permissions. user_role_slug VARCHAR(16) NOT NULL, + -- An optional comma separated list of flags for user accounts + -- If a user has a flag, then they're enabled for that given feature. + -- There are better ways to do this, but this hack will do for now. + -- This should replace `can_access_studio`. + -- + -- Possible flag values (multiple is okay) : + -- - "explore_media" + -- - "studio" + maybe_feature_flags VARCHAR(255) DEFAULT NULL, + + -- DEPRECATED + -- TODO(bt, 2024-03-05): Remove after new flags are in place. -- Rollout flag for Storyteller Studio -- Default to false until rollout is 100%, then remove the column. can_access_studio BOOLEAN NOT NULL DEFAULT false,