@paperclipai/db 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/migrations/0000_mature_masked_marvel.sql +208 -0
- package/dist/migrations/0001_fast_northstar.sql +87 -0
- package/dist/migrations/0002_big_zaladane.sql +1 -0
- package/dist/migrations/0003_shallow_quentin_quire.sql +5 -0
- package/dist/migrations/0004_issue_identifiers.sql +28 -0
- package/dist/migrations/0005_chief_luke_cage.sql +19 -0
- package/dist/migrations/0006_overjoyed_mister_sinister.sql +36 -0
- package/dist/migrations/0007_new_quentin_quire.sql +20 -0
- package/dist/migrations/0008_amused_zzzax.sql +1 -0
- package/dist/migrations/0009_fast_jackal.sql +36 -0
- package/dist/migrations/0010_stale_justin_hammer.sql +37 -0
- package/dist/migrations/0011_windy_corsair.sql +18 -0
- package/dist/migrations/0012_perpetual_ser_duncan.sql +2 -0
- package/dist/migrations/0013_dashing_wasp.sql +4 -0
- package/dist/migrations/0014_many_mikhail_rasputin.sql +135 -0
- package/dist/migrations/0015_project_color_archived.sql +2 -0
- package/dist/migrations/0016_agent_icon.sql +1 -0
- package/dist/migrations/0017_tiresome_gabe_jones.sql +51 -0
- package/dist/migrations/0018_flat_sleepwalker.sql +26 -0
- package/dist/migrations/0019_public_victor_mancha.sql +18 -0
- package/dist/migrations/0020_white_anita_blake.sql +1 -0
- package/dist/migrations/0021_chief_vindicator.sql +1 -0
- package/dist/migrations/0022_company_brand_color.sql +1 -0
- package/dist/migrations/0023_fair_lethal_legion.sql +3 -0
- package/dist/migrations/meta/0000_snapshot.json +1743 -0
- package/dist/migrations/meta/0001_snapshot.json +2441 -0
- package/dist/migrations/meta/0002_snapshot.json +2454 -0
- package/dist/migrations/meta/0003_snapshot.json +2502 -0
- package/dist/migrations/meta/0005_snapshot.json +2719 -0
- package/dist/migrations/meta/0006_snapshot.json +3048 -0
- package/dist/migrations/meta/0007_snapshot.json +3258 -0
- package/dist/migrations/meta/0008_snapshot.json +3264 -0
- package/dist/migrations/meta/0009_snapshot.json +3587 -0
- package/dist/migrations/meta/0010_snapshot.json +3929 -0
- package/dist/migrations/meta/0011_snapshot.json +4068 -0
- package/dist/migrations/meta/0012_snapshot.json +4087 -0
- package/dist/migrations/meta/0013_snapshot.json +4118 -0
- package/dist/migrations/meta/0014_snapshot.json +5187 -0
- package/dist/migrations/meta/0017_snapshot.json +5215 -0
- package/dist/migrations/meta/0018_snapshot.json +5450 -0
- package/dist/migrations/meta/0019_snapshot.json +5603 -0
- package/dist/migrations/meta/0020_snapshot.json +5603 -0
- package/dist/migrations/meta/0021_snapshot.json +5609 -0
- package/dist/migrations/meta/0023_snapshot.json +5633 -0
- package/dist/migrations/meta/_journal.json +174 -0
- package/dist/migrations/migrations/0000_mature_masked_marvel.sql +208 -0
- package/dist/migrations/migrations/0001_fast_northstar.sql +87 -0
- package/dist/migrations/migrations/0002_big_zaladane.sql +1 -0
- package/dist/migrations/migrations/0003_shallow_quentin_quire.sql +5 -0
- package/dist/migrations/migrations/0004_issue_identifiers.sql +28 -0
- package/dist/migrations/migrations/0005_chief_luke_cage.sql +19 -0
- package/dist/migrations/migrations/0006_overjoyed_mister_sinister.sql +36 -0
- package/dist/migrations/migrations/0007_new_quentin_quire.sql +20 -0
- package/dist/migrations/migrations/0008_amused_zzzax.sql +1 -0
- package/dist/migrations/migrations/0009_fast_jackal.sql +36 -0
- package/dist/migrations/migrations/0010_stale_justin_hammer.sql +37 -0
- package/dist/migrations/migrations/0011_windy_corsair.sql +18 -0
- package/dist/migrations/migrations/0012_perpetual_ser_duncan.sql +2 -0
- package/dist/migrations/migrations/0013_dashing_wasp.sql +4 -0
- package/dist/migrations/migrations/0014_many_mikhail_rasputin.sql +135 -0
- package/dist/migrations/migrations/0015_project_color_archived.sql +2 -0
- package/dist/migrations/migrations/0016_agent_icon.sql +1 -0
- package/dist/migrations/migrations/0017_tiresome_gabe_jones.sql +51 -0
- package/dist/migrations/migrations/0018_flat_sleepwalker.sql +26 -0
- package/dist/migrations/migrations/0019_public_victor_mancha.sql +18 -0
- package/dist/migrations/migrations/0020_white_anita_blake.sql +1 -0
- package/dist/migrations/migrations/0021_chief_vindicator.sql +1 -0
- package/dist/migrations/migrations/0022_company_brand_color.sql +1 -0
- package/dist/migrations/migrations/0023_fair_lethal_legion.sql +3 -0
- package/dist/migrations/migrations/meta/0000_snapshot.json +1743 -0
- package/dist/migrations/migrations/meta/0001_snapshot.json +2441 -0
- package/dist/migrations/migrations/meta/0002_snapshot.json +2454 -0
- package/dist/migrations/migrations/meta/0003_snapshot.json +2502 -0
- package/dist/migrations/migrations/meta/0005_snapshot.json +2719 -0
- package/dist/migrations/migrations/meta/0006_snapshot.json +3048 -0
- package/dist/migrations/migrations/meta/0007_snapshot.json +3258 -0
- package/dist/migrations/migrations/meta/0008_snapshot.json +3264 -0
- package/dist/migrations/migrations/meta/0009_snapshot.json +3587 -0
- package/dist/migrations/migrations/meta/0010_snapshot.json +3929 -0
- package/dist/migrations/migrations/meta/0011_snapshot.json +4068 -0
- package/dist/migrations/migrations/meta/0012_snapshot.json +4087 -0
- package/dist/migrations/migrations/meta/0013_snapshot.json +4118 -0
- package/dist/migrations/migrations/meta/0014_snapshot.json +5187 -0
- package/dist/migrations/migrations/meta/0017_snapshot.json +5215 -0
- package/dist/migrations/migrations/meta/0018_snapshot.json +5450 -0
- package/dist/migrations/migrations/meta/0019_snapshot.json +5603 -0
- package/dist/migrations/migrations/meta/0020_snapshot.json +5603 -0
- package/dist/migrations/migrations/meta/0021_snapshot.json +5609 -0
- package/dist/migrations/migrations/meta/0023_snapshot.json +5633 -0
- package/dist/migrations/migrations/meta/_journal.json +174 -0
- package/package.json +3 -3
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
CREATE TABLE "account" (
|
|
2
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"account_id" text NOT NULL,
|
|
4
|
+
"provider_id" text NOT NULL,
|
|
5
|
+
"user_id" text NOT NULL,
|
|
6
|
+
"access_token" text,
|
|
7
|
+
"refresh_token" text,
|
|
8
|
+
"id_token" text,
|
|
9
|
+
"access_token_expires_at" timestamp with time zone,
|
|
10
|
+
"refresh_token_expires_at" timestamp with time zone,
|
|
11
|
+
"scope" text,
|
|
12
|
+
"password" text,
|
|
13
|
+
"created_at" timestamp with time zone NOT NULL,
|
|
14
|
+
"updated_at" timestamp with time zone NOT NULL
|
|
15
|
+
);
|
|
16
|
+
--> statement-breakpoint
|
|
17
|
+
CREATE TABLE "session" (
|
|
18
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
19
|
+
"expires_at" timestamp with time zone NOT NULL,
|
|
20
|
+
"token" text NOT NULL,
|
|
21
|
+
"created_at" timestamp with time zone NOT NULL,
|
|
22
|
+
"updated_at" timestamp with time zone NOT NULL,
|
|
23
|
+
"ip_address" text,
|
|
24
|
+
"user_agent" text,
|
|
25
|
+
"user_id" text NOT NULL
|
|
26
|
+
);
|
|
27
|
+
--> statement-breakpoint
|
|
28
|
+
CREATE TABLE "user" (
|
|
29
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
30
|
+
"name" text NOT NULL,
|
|
31
|
+
"email" text NOT NULL,
|
|
32
|
+
"email_verified" boolean DEFAULT false NOT NULL,
|
|
33
|
+
"image" text,
|
|
34
|
+
"created_at" timestamp with time zone NOT NULL,
|
|
35
|
+
"updated_at" timestamp with time zone NOT NULL
|
|
36
|
+
);
|
|
37
|
+
--> statement-breakpoint
|
|
38
|
+
CREATE TABLE "verification" (
|
|
39
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
40
|
+
"identifier" text NOT NULL,
|
|
41
|
+
"value" text NOT NULL,
|
|
42
|
+
"expires_at" timestamp with time zone NOT NULL,
|
|
43
|
+
"created_at" timestamp with time zone,
|
|
44
|
+
"updated_at" timestamp with time zone
|
|
45
|
+
);
|
|
46
|
+
--> statement-breakpoint
|
|
47
|
+
CREATE TABLE "company_memberships" (
|
|
48
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
49
|
+
"company_id" uuid NOT NULL,
|
|
50
|
+
"principal_type" text NOT NULL,
|
|
51
|
+
"principal_id" text NOT NULL,
|
|
52
|
+
"status" text DEFAULT 'active' NOT NULL,
|
|
53
|
+
"membership_role" text,
|
|
54
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
55
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
56
|
+
);
|
|
57
|
+
--> statement-breakpoint
|
|
58
|
+
CREATE TABLE "instance_user_roles" (
|
|
59
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
60
|
+
"user_id" text NOT NULL,
|
|
61
|
+
"role" text DEFAULT 'instance_admin' NOT NULL,
|
|
62
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
63
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
64
|
+
);
|
|
65
|
+
--> statement-breakpoint
|
|
66
|
+
CREATE TABLE "invites" (
|
|
67
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
68
|
+
"company_id" uuid,
|
|
69
|
+
"invite_type" text DEFAULT 'company_join' NOT NULL,
|
|
70
|
+
"token_hash" text NOT NULL,
|
|
71
|
+
"allowed_join_types" text DEFAULT 'both' NOT NULL,
|
|
72
|
+
"defaults_payload" jsonb,
|
|
73
|
+
"expires_at" timestamp with time zone NOT NULL,
|
|
74
|
+
"invited_by_user_id" text,
|
|
75
|
+
"revoked_at" timestamp with time zone,
|
|
76
|
+
"accepted_at" timestamp with time zone,
|
|
77
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
78
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
79
|
+
);
|
|
80
|
+
--> statement-breakpoint
|
|
81
|
+
CREATE TABLE "join_requests" (
|
|
82
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
83
|
+
"invite_id" uuid NOT NULL,
|
|
84
|
+
"company_id" uuid NOT NULL,
|
|
85
|
+
"request_type" text NOT NULL,
|
|
86
|
+
"status" text DEFAULT 'pending_approval' NOT NULL,
|
|
87
|
+
"request_ip" text NOT NULL,
|
|
88
|
+
"requesting_user_id" text,
|
|
89
|
+
"request_email_snapshot" text,
|
|
90
|
+
"agent_name" text,
|
|
91
|
+
"adapter_type" text,
|
|
92
|
+
"capabilities" text,
|
|
93
|
+
"agent_defaults_payload" jsonb,
|
|
94
|
+
"created_agent_id" uuid,
|
|
95
|
+
"approved_by_user_id" text,
|
|
96
|
+
"approved_at" timestamp with time zone,
|
|
97
|
+
"rejected_by_user_id" text,
|
|
98
|
+
"rejected_at" timestamp with time zone,
|
|
99
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
100
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
101
|
+
);
|
|
102
|
+
--> statement-breakpoint
|
|
103
|
+
CREATE TABLE "principal_permission_grants" (
|
|
104
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
105
|
+
"company_id" uuid NOT NULL,
|
|
106
|
+
"principal_type" text NOT NULL,
|
|
107
|
+
"principal_id" text NOT NULL,
|
|
108
|
+
"permission_key" text NOT NULL,
|
|
109
|
+
"scope" jsonb,
|
|
110
|
+
"granted_by_user_id" text,
|
|
111
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
112
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
113
|
+
);
|
|
114
|
+
--> statement-breakpoint
|
|
115
|
+
ALTER TABLE "issues" ADD COLUMN "assignee_user_id" text;--> statement-breakpoint
|
|
116
|
+
ALTER TABLE "account" ADD CONSTRAINT "account_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
117
|
+
ALTER TABLE "session" ADD CONSTRAINT "session_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
118
|
+
ALTER TABLE "company_memberships" ADD CONSTRAINT "company_memberships_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
119
|
+
ALTER TABLE "invites" ADD CONSTRAINT "invites_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
120
|
+
ALTER TABLE "join_requests" ADD CONSTRAINT "join_requests_invite_id_invites_id_fk" FOREIGN KEY ("invite_id") REFERENCES "public"."invites"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
121
|
+
ALTER TABLE "join_requests" ADD CONSTRAINT "join_requests_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
122
|
+
ALTER TABLE "join_requests" ADD CONSTRAINT "join_requests_created_agent_id_agents_id_fk" FOREIGN KEY ("created_agent_id") REFERENCES "public"."agents"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
123
|
+
ALTER TABLE "principal_permission_grants" ADD CONSTRAINT "principal_permission_grants_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
124
|
+
CREATE UNIQUE INDEX "company_memberships_company_principal_unique_idx" ON "company_memberships" USING btree ("company_id","principal_type","principal_id");--> statement-breakpoint
|
|
125
|
+
CREATE INDEX "company_memberships_principal_status_idx" ON "company_memberships" USING btree ("principal_type","principal_id","status");--> statement-breakpoint
|
|
126
|
+
CREATE INDEX "company_memberships_company_status_idx" ON "company_memberships" USING btree ("company_id","status");--> statement-breakpoint
|
|
127
|
+
CREATE UNIQUE INDEX "instance_user_roles_user_role_unique_idx" ON "instance_user_roles" USING btree ("user_id","role");--> statement-breakpoint
|
|
128
|
+
CREATE INDEX "instance_user_roles_role_idx" ON "instance_user_roles" USING btree ("role");--> statement-breakpoint
|
|
129
|
+
CREATE UNIQUE INDEX "invites_token_hash_unique_idx" ON "invites" USING btree ("token_hash");--> statement-breakpoint
|
|
130
|
+
CREATE INDEX "invites_company_invite_state_idx" ON "invites" USING btree ("company_id","invite_type","revoked_at","expires_at");--> statement-breakpoint
|
|
131
|
+
CREATE UNIQUE INDEX "join_requests_invite_unique_idx" ON "join_requests" USING btree ("invite_id");--> statement-breakpoint
|
|
132
|
+
CREATE INDEX "join_requests_company_status_type_created_idx" ON "join_requests" USING btree ("company_id","status","request_type","created_at");--> statement-breakpoint
|
|
133
|
+
CREATE UNIQUE INDEX "principal_permission_grants_unique_idx" ON "principal_permission_grants" USING btree ("company_id","principal_type","principal_id","permission_key");--> statement-breakpoint
|
|
134
|
+
CREATE INDEX "principal_permission_grants_company_permission_idx" ON "principal_permission_grants" USING btree ("company_id","permission_key");--> statement-breakpoint
|
|
135
|
+
CREATE INDEX "issues_company_assignee_user_status_idx" ON "issues" USING btree ("company_id","assignee_user_id","status");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "agents" ADD COLUMN "icon" text;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
DROP INDEX "issues_company_identifier_idx";--> statement-breakpoint
|
|
2
|
+
|
|
3
|
+
-- Rebuild issue prefixes to be company-specific and globally unique.
|
|
4
|
+
-- Base prefix is first 3 letters of company name (A-Z only), fallback "CMP".
|
|
5
|
+
-- Duplicate bases receive deterministic letter suffixes: PAP, PAPA, PAPAA, ...
|
|
6
|
+
WITH ranked_companies AS (
|
|
7
|
+
SELECT
|
|
8
|
+
c.id,
|
|
9
|
+
COALESCE(NULLIF(SUBSTRING(REGEXP_REPLACE(UPPER(c.name), '[^A-Z]', '', 'g') FROM 1 FOR 3), ''), 'CMP') AS base_prefix,
|
|
10
|
+
ROW_NUMBER() OVER (
|
|
11
|
+
PARTITION BY COALESCE(NULLIF(SUBSTRING(REGEXP_REPLACE(UPPER(c.name), '[^A-Z]', '', 'g') FROM 1 FOR 3), ''), 'CMP')
|
|
12
|
+
ORDER BY c.created_at, c.id
|
|
13
|
+
) AS prefix_rank
|
|
14
|
+
FROM companies c
|
|
15
|
+
)
|
|
16
|
+
UPDATE companies c
|
|
17
|
+
SET issue_prefix = CASE
|
|
18
|
+
WHEN ranked_companies.prefix_rank = 1 THEN ranked_companies.base_prefix
|
|
19
|
+
ELSE ranked_companies.base_prefix || REPEAT('A', (ranked_companies.prefix_rank - 1)::integer)
|
|
20
|
+
END
|
|
21
|
+
FROM ranked_companies
|
|
22
|
+
WHERE c.id = ranked_companies.id;--> statement-breakpoint
|
|
23
|
+
|
|
24
|
+
-- Reassign issue numbers sequentially per company to guarantee uniqueness.
|
|
25
|
+
WITH numbered_issues AS (
|
|
26
|
+
SELECT
|
|
27
|
+
i.id,
|
|
28
|
+
ROW_NUMBER() OVER (PARTITION BY i.company_id ORDER BY i.created_at, i.id) AS issue_number
|
|
29
|
+
FROM issues i
|
|
30
|
+
)
|
|
31
|
+
UPDATE issues i
|
|
32
|
+
SET issue_number = numbered_issues.issue_number
|
|
33
|
+
FROM numbered_issues
|
|
34
|
+
WHERE i.id = numbered_issues.id;--> statement-breakpoint
|
|
35
|
+
|
|
36
|
+
-- Rebuild identifiers from normalized prefix + issue number.
|
|
37
|
+
UPDATE issues i
|
|
38
|
+
SET identifier = c.issue_prefix || '-' || i.issue_number
|
|
39
|
+
FROM companies c
|
|
40
|
+
WHERE c.id = i.company_id;--> statement-breakpoint
|
|
41
|
+
|
|
42
|
+
-- Sync counters to the largest issue number currently assigned per company.
|
|
43
|
+
UPDATE companies c
|
|
44
|
+
SET issue_counter = COALESCE((
|
|
45
|
+
SELECT MAX(i.issue_number)
|
|
46
|
+
FROM issues i
|
|
47
|
+
WHERE i.company_id = c.id
|
|
48
|
+
), 0);--> statement-breakpoint
|
|
49
|
+
|
|
50
|
+
CREATE UNIQUE INDEX "companies_issue_prefix_idx" ON "companies" USING btree ("issue_prefix");--> statement-breakpoint
|
|
51
|
+
CREATE UNIQUE INDEX "issues_identifier_idx" ON "issues" USING btree ("identifier");
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
CREATE TABLE "issue_labels" (
|
|
2
|
+
"issue_id" uuid NOT NULL,
|
|
3
|
+
"label_id" uuid NOT NULL,
|
|
4
|
+
"company_id" uuid NOT NULL,
|
|
5
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
6
|
+
CONSTRAINT "issue_labels_pk" PRIMARY KEY("issue_id","label_id")
|
|
7
|
+
);
|
|
8
|
+
--> statement-breakpoint
|
|
9
|
+
CREATE TABLE "labels" (
|
|
10
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
11
|
+
"company_id" uuid NOT NULL,
|
|
12
|
+
"name" text NOT NULL,
|
|
13
|
+
"color" text NOT NULL,
|
|
14
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
15
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
16
|
+
);
|
|
17
|
+
--> statement-breakpoint
|
|
18
|
+
ALTER TABLE "issue_labels" ADD CONSTRAINT "issue_labels_issue_id_issues_id_fk" FOREIGN KEY ("issue_id") REFERENCES "public"."issues"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
19
|
+
ALTER TABLE "issue_labels" ADD CONSTRAINT "issue_labels_label_id_labels_id_fk" FOREIGN KEY ("label_id") REFERENCES "public"."labels"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
20
|
+
ALTER TABLE "issue_labels" ADD CONSTRAINT "issue_labels_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
21
|
+
ALTER TABLE "labels" ADD CONSTRAINT "labels_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
22
|
+
CREATE INDEX "issue_labels_issue_idx" ON "issue_labels" USING btree ("issue_id");--> statement-breakpoint
|
|
23
|
+
CREATE INDEX "issue_labels_label_idx" ON "issue_labels" USING btree ("label_id");--> statement-breakpoint
|
|
24
|
+
CREATE INDEX "issue_labels_company_idx" ON "issue_labels" USING btree ("company_id");--> statement-breakpoint
|
|
25
|
+
CREATE INDEX "labels_company_idx" ON "labels" USING btree ("company_id");--> statement-breakpoint
|
|
26
|
+
CREATE UNIQUE INDEX "labels_company_name_idx" ON "labels" USING btree ("company_id","name");
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
CREATE TABLE "project_workspaces" (
|
|
2
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
3
|
+
"company_id" uuid NOT NULL,
|
|
4
|
+
"project_id" uuid NOT NULL,
|
|
5
|
+
"name" text NOT NULL,
|
|
6
|
+
"cwd" text NOT NULL,
|
|
7
|
+
"repo_url" text,
|
|
8
|
+
"repo_ref" text,
|
|
9
|
+
"metadata" jsonb,
|
|
10
|
+
"is_primary" boolean DEFAULT false NOT NULL,
|
|
11
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
12
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
13
|
+
);
|
|
14
|
+
--> statement-breakpoint
|
|
15
|
+
ALTER TABLE "project_workspaces" ADD CONSTRAINT "project_workspaces_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
16
|
+
ALTER TABLE "project_workspaces" ADD CONSTRAINT "project_workspaces_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
17
|
+
CREATE INDEX "project_workspaces_company_project_idx" ON "project_workspaces" USING btree ("company_id","project_id");--> statement-breakpoint
|
|
18
|
+
CREATE INDEX "project_workspaces_project_primary_idx" ON "project_workspaces" USING btree ("project_id","is_primary");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "project_workspaces" ALTER COLUMN "cwd" DROP NOT NULL;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "issues" ADD COLUMN "assignee_adapter_overrides" jsonb;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "companies" ADD COLUMN "brand_color" text;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
ALTER TABLE "join_requests" ADD COLUMN "claim_secret_hash" text;--> statement-breakpoint
|
|
2
|
+
ALTER TABLE "join_requests" ADD COLUMN "claim_secret_expires_at" timestamp with time zone;--> statement-breakpoint
|
|
3
|
+
ALTER TABLE "join_requests" ADD COLUMN "claim_secret_consumed_at" timestamp with time zone;
|