diff --git a/pkg/identityserver/store/migrations/20240103000001_console_preferences.down.sql b/pkg/identityserver/store/migrations/20240103000001_console_preferences.down.sql new file mode 100644 index 00000000000..fd71d4a2563 --- /dev/null +++ b/pkg/identityserver/store/migrations/20240103000001_console_preferences.down.sql @@ -0,0 +1,15 @@ +ALTER TABLE users DROP COLUMN IF EXISTS console_preferences CASCADE; + +--bun:split +CREATE OR REPLACE VIEW user_accounts AS +SELECT + acc.id AS account_id, + acc.created_at AS account_created_at, + acc.updated_at AS account_updated_at, + acc.deleted_at AS account_deleted_at, + acc.uid AS account_uid, + usr.* +FROM + accounts acc + JOIN users usr ON usr.id = acc.account_id + AND acc.account_type = 'user'; diff --git a/pkg/identityserver/store/migrations/20240103000001_console_preferences.up.sql b/pkg/identityserver/store/migrations/20240103000001_console_preferences.up.sql new file mode 100644 index 00000000000..cbf83c5f2c3 --- /dev/null +++ b/pkg/identityserver/store/migrations/20240103000001_console_preferences.up.sql @@ -0,0 +1,16 @@ +ALTER TABLE users +ADD COLUMN IF NOT EXISTS console_preferences bytea; + +--bun:split +CREATE OR REPLACE VIEW user_accounts AS +SELECT + acc.id AS account_id, + acc.created_at AS account_created_at, + acc.updated_at AS account_updated_at, + acc.deleted_at AS account_deleted_at, + acc.uid AS account_uid, + usr.* +FROM + accounts acc + JOIN users usr ON usr.id = acc.account_id + AND acc.account_type = 'user';