Merge latest dashboard and Turbo setup into dev while preserving workspace features
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
BEGIN;
|
||||
CREATE TABLE workspaces (
|
||||
id uuid PRIMARY KEY,
|
||||
owner_id uuid NOT NULL REFERENCES account_users(id),
|
||||
name text NOT NULL CHECK (char_length(name) BETWEEN 1 AND 40),
|
||||
purpose text NOT NULL CHECK (purpose IN ('工作与团队','个人创作','学习与研究')),
|
||||
created_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
CREATE TABLE workspace_members (
|
||||
workspace_id uuid NOT NULL REFERENCES workspaces(id) ON DELETE CASCADE,
|
||||
user_id uuid NOT NULL REFERENCES account_users(id) ON DELETE CASCADE,
|
||||
PRIMARY KEY (workspace_id, user_id)
|
||||
);
|
||||
CREATE INDEX workspace_members_user ON workspace_members(user_id);
|
||||
CREATE TABLE workspace_invites (
|
||||
digest text PRIMARY KEY,
|
||||
workspace_id uuid NOT NULL REFERENCES workspaces(id) ON DELETE CASCADE,
|
||||
expires_at timestamptz NOT NULL
|
||||
);
|
||||
CREATE INDEX workspace_invites_workspace ON workspace_invites(workspace_id);
|
||||
INSERT INTO schema_migrations(version) VALUES ('018_workspaces');
|
||||
COMMIT;
|
||||
Reference in New Issue
Block a user