@@ -43,10 +43,16 @@ beforeAll(async () => {
4343 CREATE TABLE workspace (
4444 id text PRIMARY KEY, name text, owner_id text, organization_id text, workspace_mode text,
4545 project_id text NOT NULL REFERENCES project(id) ON DELETE RESTRICT,
46+ forked_from_workspace_id text,
4647 billed_account_user_id text, allow_personal_api_keys boolean DEFAULT true,
4748 archived_at timestamp, organization_assigned_at timestamp, updated_at timestamp,
4849 storage_used_bytes bigint NOT NULL
4950 );
51+ CREATE TABLE project_workspace (
52+ project_id text NOT NULL REFERENCES project(id) ON DELETE RESTRICT,
53+ workspace_id text NOT NULL UNIQUE REFERENCES workspace(id) ON DELETE CASCADE,
54+ PRIMARY KEY (project_id, workspace_id)
55+ );
5056 CREATE TABLE permissions (
5157 id text PRIMARY KEY, user_id text, entity_type text, entity_id text, permission_type text,
5258 created_at timestamp, updated_at timestamp, UNIQUE(user_id, entity_type, entity_id)
@@ -64,7 +70,7 @@ beforeAll(async () => {
6470
6571beforeEach ( async ( ) => {
6672 await connection . unsafe ( `
67- TRUNCATE member, organization, project, permission_group, invitation, user_stats, workspace, permissions,
73+ TRUNCATE member, organization, project, project_workspace, permission_group, invitation, user_stats, workspace, permissions,
6874 workspace_files, knowledge_base, document, knowledge_connector;
6975 INSERT INTO member VALUES ('owner-membership', 'org', 'org-owner', 'owner');
7076 INSERT INTO organization VALUES ('org', 40);
0 commit comments