Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add console preferences migration #6857

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
DROP TABLE IF EXISTS user_bookmarks CASCADE;

--bun:split
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';
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ALTER TABLE users
ADD COLUMN IF NOT EXISTS console_preferences bytea;

--bun:split
CREATE TABLE user_bookmarks (
id uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,

user_id character varying(36) NOT NULL,
entity_id character varying(36) NOT NULL,
entity_type character varying(32) NOT NULL
);

CREATE UNIQUE INDEX user_bookmarks_user_id_entity_id_entity_type_idx
ON user_bookmarks (user_id, entity_id, entity_type);

--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';
Loading