@wraps.dev/cli 2.21.5 → 2.21.10
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/api-lambda.zip +0 -0
- package/dist/cli.js +868 -770
- package/dist/cli.js.map +1 -1
- package/dist/lambda/event-processor/.bundled +1 -1
- package/dist/lambda/inbound-processor/.bundled +1 -1
- package/dist/lambda/sms-event-processor/.bundled +1 -1
- package/dist/selfhost-migrations/0000_absent_rogue.sql +203 -0
- package/dist/selfhost-migrations/0001_polite_maverick.sql +17 -0
- package/dist/selfhost-migrations/0002_perpetual_scorpion.sql +1 -0
- package/dist/selfhost-migrations/0003_wealthy_absorbing_man.sql +1 -0
- package/dist/selfhost-migrations/0004_opposite_blur.sql +1 -0
- package/dist/selfhost-migrations/0005_clear_terror.sql +4 -0
- package/dist/selfhost-migrations/0006_soft_black_widow.sql +20 -0
- package/dist/selfhost-migrations/0007_dazzling_saracen.sql +124 -0
- package/dist/selfhost-migrations/0008_broad_hannibal_king.sql +33 -0
- package/dist/selfhost-migrations/0009_bouncy_mystique.sql +73 -0
- package/dist/selfhost-migrations/0010_cheerful_valeria_richards.sql +18 -0
- package/dist/selfhost-migrations/0011_absent_thunderbolts.sql +2 -0
- package/dist/selfhost-migrations/0012_demonic_donald_blake.sql +1 -0
- package/dist/selfhost-migrations/0013_nifty_preak.sql +143 -0
- package/dist/selfhost-migrations/0014_hesitant_beast.sql +2 -0
- package/dist/selfhost-migrations/0015_blue_giant_girl.sql +1 -0
- package/dist/selfhost-migrations/0016_cooing_overlord.sql +1 -0
- package/dist/selfhost-migrations/0017_tranquil_ender_wiggin.sql +11 -0
- package/dist/selfhost-migrations/0018_talented_groot.sql +8 -0
- package/dist/selfhost-migrations/0019_ambitious_devos.sql +3 -0
- package/dist/selfhost-migrations/0020_misty_master_mold.sql +95 -0
- package/dist/selfhost-migrations/0021_regular_harrier.sql +14 -0
- package/dist/selfhost-migrations/0022_sour_blizzard.sql +10 -0
- package/dist/selfhost-migrations/0023_flawless_psynapse.sql +1 -0
- package/dist/selfhost-migrations/0024_premium_blindfold.sql +1 -0
- package/dist/selfhost-migrations/0025_unusual_santa_claus.sql +1 -0
- package/dist/selfhost-migrations/0026_volatile_pandemic.sql +2 -0
- package/dist/selfhost-migrations/0027_workable_logan.sql +4 -0
- package/dist/selfhost-migrations/0028_familiar_prodigy.sql +1 -0
- package/dist/selfhost-migrations/0029_cute_maddog.sql +13 -0
- package/dist/selfhost-migrations/0030_adorable_scarecrow.sql +1 -0
- package/dist/selfhost-migrations/0031_material_slapstick.sql +10 -0
- package/dist/selfhost-migrations/0032_hot_dust.sql +11 -0
- package/dist/selfhost-migrations/0033_slow_deathbird.sql +1 -0
- package/dist/selfhost-migrations/0034_lush_rafael_vega.sql +12 -0
- package/dist/selfhost-migrations/0035_normal_red_hulk.sql +8 -0
- package/dist/selfhost-migrations/0036_marvelous_ezekiel.sql +1 -0
- package/dist/selfhost-migrations/0037_swift_talisman.sql +8 -0
- package/dist/selfhost-migrations/0038_first_mandroid.sql +1 -0
- package/dist/selfhost-migrations/0039_fixed_stryfe.sql +1 -0
- package/dist/selfhost-migrations/0040_add_channel_check_constraints.sql +2 -0
- package/dist/selfhost-migrations/0041_black_spencer_smythe.sql +1 -0
- package/dist/selfhost-migrations/0042_plain_marvel_zombies.sql +2 -0
- package/dist/selfhost-migrations/0043_curved_champions.sql +1 -0
- package/dist/selfhost-migrations/0044_clean_iceman.sql +1 -0
- package/dist/selfhost-migrations/0045_condemned_steel_serpent.sql +1 -0
- package/dist/selfhost-migrations/0046_steep_ultimo.sql +2 -0
- package/dist/selfhost-migrations/0047_empty_sleepwalker.sql +2 -0
- package/dist/selfhost-migrations/0048_cheerful_multiple_man.sql +1 -0
- package/dist/selfhost-migrations/0049_nostalgic_loki.sql +3 -0
- package/dist/selfhost-migrations/0050_add_engagement_metadata.sql +4 -0
- package/dist/selfhost-migrations/0051_odd_marrow.sql +2 -0
- package/dist/selfhost-migrations/0052_redundant_siren.sql +5 -0
- package/dist/selfhost-migrations/0053_soft_carnage.sql +31 -0
- package/dist/selfhost-migrations/0054_blushing_vin_gonzales.sql +1 -0
- package/dist/selfhost-migrations/0055_broadcast_resume_columns.sql +12 -0
- package/dist/selfhost-migrations/0056_broadcast_resume_dedup_cleanup.sql +31 -0
- package/dist/selfhost-migrations/0057_audit_log_actoremail_jsonb.sql +5 -0
- package/package.json +7 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
Built at: 2026-05-
|
|
1
|
+
Built at: 2026-05-26T16:38:41.736Z
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Built at: 2026-05-
|
|
1
|
+
Built at: 2026-05-26T16:38:41.816Z
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Built at: 2026-05-
|
|
1
|
+
Built at: 2026-05-26T16:38:41.747Z
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
CREATE TABLE "api_key" (
|
|
2
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"organization_id" text NOT NULL,
|
|
4
|
+
"name" text NOT NULL,
|
|
5
|
+
"key_hash" text NOT NULL,
|
|
6
|
+
"prefix" text NOT NULL,
|
|
7
|
+
"permissions" json DEFAULT '[]'::json,
|
|
8
|
+
"last_used_at" timestamp,
|
|
9
|
+
"expires_at" timestamp,
|
|
10
|
+
"created_by" text,
|
|
11
|
+
"created_at" timestamp DEFAULT now() NOT NULL
|
|
12
|
+
);
|
|
13
|
+
--> statement-breakpoint
|
|
14
|
+
CREATE TABLE "audit_log" (
|
|
15
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
16
|
+
"organization_id" text NOT NULL,
|
|
17
|
+
"user_id" text,
|
|
18
|
+
"action" text NOT NULL,
|
|
19
|
+
"resource" text NOT NULL,
|
|
20
|
+
"resource_id" text,
|
|
21
|
+
"metadata" json,
|
|
22
|
+
"ip_address" text,
|
|
23
|
+
"user_agent" text,
|
|
24
|
+
"created_at" timestamp DEFAULT now() NOT NULL
|
|
25
|
+
);
|
|
26
|
+
--> statement-breakpoint
|
|
27
|
+
CREATE TABLE "aws_account" (
|
|
28
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
29
|
+
"organization_id" text NOT NULL,
|
|
30
|
+
"name" text NOT NULL,
|
|
31
|
+
"account_id" text NOT NULL,
|
|
32
|
+
"region" text NOT NULL,
|
|
33
|
+
"role_arn" text NOT NULL,
|
|
34
|
+
"external_id" text NOT NULL,
|
|
35
|
+
"is_verified" boolean DEFAULT false NOT NULL,
|
|
36
|
+
"last_verified_at" timestamp,
|
|
37
|
+
"created_by" text,
|
|
38
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
39
|
+
"updated_at" timestamp DEFAULT now() NOT NULL,
|
|
40
|
+
CONSTRAINT "aws_account_external_id_unique" UNIQUE("external_id")
|
|
41
|
+
);
|
|
42
|
+
--> statement-breakpoint
|
|
43
|
+
CREATE TABLE "email_template" (
|
|
44
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
45
|
+
"organization_id" text NOT NULL,
|
|
46
|
+
"name" text NOT NULL,
|
|
47
|
+
"subject" text,
|
|
48
|
+
"html" text,
|
|
49
|
+
"variables" json DEFAULT '[]'::json,
|
|
50
|
+
"created_by" text,
|
|
51
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
52
|
+
"updated_at" timestamp DEFAULT now() NOT NULL
|
|
53
|
+
);
|
|
54
|
+
--> statement-breakpoint
|
|
55
|
+
CREATE TABLE "organization_extension" (
|
|
56
|
+
"organization_id" text PRIMARY KEY NOT NULL,
|
|
57
|
+
"plan" text DEFAULT 'free' NOT NULL,
|
|
58
|
+
"stripe_customer_id" text,
|
|
59
|
+
"stripe_subscription_id" text,
|
|
60
|
+
"aws_account_count" integer DEFAULT 0 NOT NULL,
|
|
61
|
+
"member_count" integer DEFAULT 1 NOT NULL,
|
|
62
|
+
"updated_at" timestamp DEFAULT now() NOT NULL
|
|
63
|
+
);
|
|
64
|
+
--> statement-breakpoint
|
|
65
|
+
CREATE TABLE "account" (
|
|
66
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
67
|
+
"account_id" text NOT NULL,
|
|
68
|
+
"provider_id" text NOT NULL,
|
|
69
|
+
"user_id" text NOT NULL,
|
|
70
|
+
"access_token" text,
|
|
71
|
+
"refresh_token" text,
|
|
72
|
+
"id_token" text,
|
|
73
|
+
"access_token_expires_at" timestamp,
|
|
74
|
+
"refresh_token_expires_at" timestamp,
|
|
75
|
+
"scope" text,
|
|
76
|
+
"password" text,
|
|
77
|
+
"created_at" timestamp NOT NULL,
|
|
78
|
+
"updated_at" timestamp NOT NULL
|
|
79
|
+
);
|
|
80
|
+
--> statement-breakpoint
|
|
81
|
+
CREATE TABLE "invitation" (
|
|
82
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
83
|
+
"organization_id" text NOT NULL,
|
|
84
|
+
"email" text NOT NULL,
|
|
85
|
+
"role" text,
|
|
86
|
+
"status" text NOT NULL,
|
|
87
|
+
"expires_at" timestamp NOT NULL,
|
|
88
|
+
"inviter_id" text NOT NULL
|
|
89
|
+
);
|
|
90
|
+
--> statement-breakpoint
|
|
91
|
+
CREATE TABLE "member" (
|
|
92
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
93
|
+
"organization_id" text NOT NULL,
|
|
94
|
+
"user_id" text NOT NULL,
|
|
95
|
+
"role" text NOT NULL,
|
|
96
|
+
"created_at" timestamp NOT NULL
|
|
97
|
+
);
|
|
98
|
+
--> statement-breakpoint
|
|
99
|
+
CREATE TABLE "organization" (
|
|
100
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
101
|
+
"name" text NOT NULL,
|
|
102
|
+
"slug" text,
|
|
103
|
+
"logo" text,
|
|
104
|
+
"metadata" text,
|
|
105
|
+
"created_at" timestamp NOT NULL,
|
|
106
|
+
CONSTRAINT "organization_slug_unique" UNIQUE("slug")
|
|
107
|
+
);
|
|
108
|
+
--> statement-breakpoint
|
|
109
|
+
CREATE TABLE "passkey" (
|
|
110
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
111
|
+
"name" text,
|
|
112
|
+
"public_key" text NOT NULL,
|
|
113
|
+
"user_id" text NOT NULL,
|
|
114
|
+
"credential_id" text NOT NULL,
|
|
115
|
+
"counter" integer NOT NULL,
|
|
116
|
+
"device_type" text NOT NULL,
|
|
117
|
+
"backed_up" boolean NOT NULL,
|
|
118
|
+
"transports" text,
|
|
119
|
+
"created_at" timestamp NOT NULL,
|
|
120
|
+
"aaguid" text
|
|
121
|
+
);
|
|
122
|
+
--> statement-breakpoint
|
|
123
|
+
CREATE TABLE "session" (
|
|
124
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
125
|
+
"expires_at" timestamp NOT NULL,
|
|
126
|
+
"token" text NOT NULL,
|
|
127
|
+
"created_at" timestamp NOT NULL,
|
|
128
|
+
"updated_at" timestamp NOT NULL,
|
|
129
|
+
"ip_address" text,
|
|
130
|
+
"user_agent" text,
|
|
131
|
+
"user_id" text NOT NULL,
|
|
132
|
+
"active_organization_id" text,
|
|
133
|
+
CONSTRAINT "session_token_unique" UNIQUE("token")
|
|
134
|
+
);
|
|
135
|
+
--> statement-breakpoint
|
|
136
|
+
CREATE TABLE "statement" (
|
|
137
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
138
|
+
"user_id" text,
|
|
139
|
+
"organization_id" text,
|
|
140
|
+
"role_id" text,
|
|
141
|
+
"effect" text NOT NULL,
|
|
142
|
+
"action" text NOT NULL,
|
|
143
|
+
"resource" text NOT NULL,
|
|
144
|
+
"condition" text,
|
|
145
|
+
"expires_at" timestamp,
|
|
146
|
+
"created_at" timestamp NOT NULL,
|
|
147
|
+
"updated_at" timestamp NOT NULL
|
|
148
|
+
);
|
|
149
|
+
--> statement-breakpoint
|
|
150
|
+
CREATE TABLE "two_factor" (
|
|
151
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
152
|
+
"secret" text NOT NULL,
|
|
153
|
+
"backup_codes" text NOT NULL,
|
|
154
|
+
"user_id" text NOT NULL
|
|
155
|
+
);
|
|
156
|
+
--> statement-breakpoint
|
|
157
|
+
CREATE TABLE "user" (
|
|
158
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
159
|
+
"name" text NOT NULL,
|
|
160
|
+
"email" text NOT NULL,
|
|
161
|
+
"email_verified" boolean NOT NULL,
|
|
162
|
+
"image" text,
|
|
163
|
+
"created_at" timestamp NOT NULL,
|
|
164
|
+
"updated_at" timestamp NOT NULL,
|
|
165
|
+
"two_factor_enabled" boolean,
|
|
166
|
+
CONSTRAINT "user_email_unique" UNIQUE("email")
|
|
167
|
+
);
|
|
168
|
+
--> statement-breakpoint
|
|
169
|
+
CREATE TABLE "verification" (
|
|
170
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
171
|
+
"identifier" text NOT NULL,
|
|
172
|
+
"value" text NOT NULL,
|
|
173
|
+
"expires_at" timestamp NOT NULL,
|
|
174
|
+
"created_at" timestamp,
|
|
175
|
+
"updated_at" timestamp
|
|
176
|
+
);
|
|
177
|
+
--> statement-breakpoint
|
|
178
|
+
ALTER TABLE "api_key" ADD CONSTRAINT "api_key_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
179
|
+
ALTER TABLE "api_key" ADD CONSTRAINT "api_key_created_by_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
180
|
+
ALTER TABLE "audit_log" ADD CONSTRAINT "audit_log_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
181
|
+
ALTER TABLE "audit_log" ADD CONSTRAINT "audit_log_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
182
|
+
ALTER TABLE "aws_account" ADD CONSTRAINT "aws_account_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
183
|
+
ALTER TABLE "aws_account" ADD CONSTRAINT "aws_account_created_by_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
184
|
+
ALTER TABLE "email_template" ADD CONSTRAINT "email_template_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
185
|
+
ALTER TABLE "email_template" ADD CONSTRAINT "email_template_created_by_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
186
|
+
ALTER TABLE "organization_extension" ADD CONSTRAINT "organization_extension_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
187
|
+
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
|
|
188
|
+
ALTER TABLE "invitation" ADD CONSTRAINT "invitation_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
189
|
+
ALTER TABLE "invitation" ADD CONSTRAINT "invitation_inviter_id_user_id_fk" FOREIGN KEY ("inviter_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
190
|
+
ALTER TABLE "member" ADD CONSTRAINT "member_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
191
|
+
ALTER TABLE "member" ADD CONSTRAINT "member_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
192
|
+
ALTER TABLE "passkey" ADD CONSTRAINT "passkey_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
193
|
+
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
|
|
194
|
+
ALTER TABLE "statement" ADD CONSTRAINT "statement_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
195
|
+
ALTER TABLE "statement" ADD CONSTRAINT "statement_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
196
|
+
ALTER TABLE "two_factor" ADD CONSTRAINT "two_factor_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
197
|
+
CREATE INDEX "api_key_org_idx" ON "api_key" USING btree ("organization_id");--> statement-breakpoint
|
|
198
|
+
CREATE INDEX "api_key_prefix_idx" ON "api_key" USING btree ("prefix");--> statement-breakpoint
|
|
199
|
+
CREATE INDEX "audit_log_org_idx" ON "audit_log" USING btree ("organization_id");--> statement-breakpoint
|
|
200
|
+
CREATE INDEX "audit_log_timestamp_idx" ON "audit_log" USING btree ("created_at");--> statement-breakpoint
|
|
201
|
+
CREATE INDEX "aws_account_org_idx" ON "aws_account" USING btree ("organization_id");--> statement-breakpoint
|
|
202
|
+
CREATE INDEX "aws_account_external_id_idx" ON "aws_account" USING btree ("external_id");--> statement-breakpoint
|
|
203
|
+
CREATE INDEX "email_template_org_idx" ON "email_template" USING btree ("organization_id");
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
CREATE TABLE "aws_account_permission" (
|
|
2
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"user_id" text NOT NULL,
|
|
4
|
+
"aws_account_id" text NOT NULL,
|
|
5
|
+
"permissions" json NOT NULL,
|
|
6
|
+
"granted_by" text NOT NULL,
|
|
7
|
+
"expires_at" timestamp,
|
|
8
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
9
|
+
"updated_at" timestamp DEFAULT now() NOT NULL
|
|
10
|
+
);
|
|
11
|
+
--> statement-breakpoint
|
|
12
|
+
ALTER TABLE "aws_account_permission" ADD CONSTRAINT "aws_account_permission_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
13
|
+
ALTER TABLE "aws_account_permission" ADD CONSTRAINT "aws_account_permission_aws_account_id_aws_account_id_fk" FOREIGN KEY ("aws_account_id") REFERENCES "public"."aws_account"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
14
|
+
ALTER TABLE "aws_account_permission" ADD CONSTRAINT "aws_account_permission_granted_by_user_id_fk" FOREIGN KEY ("granted_by") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
15
|
+
CREATE INDEX "aws_account_permission_user_idx" ON "aws_account_permission" USING btree ("user_id");--> statement-breakpoint
|
|
16
|
+
CREATE INDEX "aws_account_permission_account_idx" ON "aws_account_permission" USING btree ("aws_account_id");--> statement-breakpoint
|
|
17
|
+
CREATE INDEX "aws_account_permission_unique_idx" ON "aws_account_permission" USING btree ("user_id","aws_account_id");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "user" ADD COLUMN "last_login_method" text;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "aws_account" ADD COLUMN "archiving_enabled" boolean DEFAULT false NOT NULL;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "aws_account" ADD COLUMN "archive_arn" text;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
ALTER TABLE "aws_account" ADD COLUMN "event_history_enabled" boolean DEFAULT false NOT NULL;--> statement-breakpoint
|
|
2
|
+
ALTER TABLE "aws_account" ADD COLUMN "event_tracking_enabled" boolean DEFAULT false NOT NULL;--> statement-breakpoint
|
|
3
|
+
ALTER TABLE "aws_account" ADD COLUMN "config_set_name" text;--> statement-breakpoint
|
|
4
|
+
ALTER TABLE "aws_account" ADD COLUMN "custom_tracking_domain" text;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
CREATE TABLE "subscription" (
|
|
2
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"plan" text NOT NULL,
|
|
4
|
+
"reference_id" text NOT NULL,
|
|
5
|
+
"stripe_customer_id" text,
|
|
6
|
+
"stripe_subscription_id" text,
|
|
7
|
+
"status" text NOT NULL,
|
|
8
|
+
"period_start" timestamp,
|
|
9
|
+
"period_end" timestamp,
|
|
10
|
+
"cancel_at_period_end" boolean,
|
|
11
|
+
"seats" integer,
|
|
12
|
+
"trial_start" timestamp,
|
|
13
|
+
"trial_end" timestamp,
|
|
14
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
15
|
+
"updated_at" timestamp DEFAULT now() NOT NULL
|
|
16
|
+
);
|
|
17
|
+
--> statement-breakpoint
|
|
18
|
+
ALTER TABLE "organization_extension" ADD COLUMN "onboarding_completed" boolean DEFAULT false NOT NULL;--> statement-breakpoint
|
|
19
|
+
ALTER TABLE "organization_extension" ADD COLUMN "onboarding_completed_at" timestamp;--> statement-breakpoint
|
|
20
|
+
ALTER TABLE "user" ADD COLUMN "stripe_customer_id" text;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
CREATE TYPE "public"."template_status" AS ENUM('DRAFT', 'PUBLISHED', 'ARCHIVED');--> statement-breakpoint
|
|
2
|
+
CREATE TYPE "public"."variable_type" AS ENUM('TEXT', 'NUMBER', 'BOOLEAN', 'DATE', 'URL', 'EMAIL');--> statement-breakpoint
|
|
3
|
+
CREATE TABLE "ai_conversation" (
|
|
4
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
5
|
+
"organization_id" text NOT NULL,
|
|
6
|
+
"template_id" text,
|
|
7
|
+
"messages" jsonb DEFAULT '[]'::jsonb,
|
|
8
|
+
"total_tokens" integer DEFAULT 0 NOT NULL,
|
|
9
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
10
|
+
"updated_at" timestamp DEFAULT now() NOT NULL,
|
|
11
|
+
"created_by" text NOT NULL
|
|
12
|
+
);
|
|
13
|
+
--> statement-breakpoint
|
|
14
|
+
CREATE TABLE "brand_kit" (
|
|
15
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
16
|
+
"organization_id" text NOT NULL,
|
|
17
|
+
"name" text DEFAULT 'Default' NOT NULL,
|
|
18
|
+
"logo_url" text,
|
|
19
|
+
"primary_color" text DEFAULT '#5046e5' NOT NULL,
|
|
20
|
+
"secondary_color" text DEFAULT '#6366f1' NOT NULL,
|
|
21
|
+
"background_color" text DEFAULT '#ffffff' NOT NULL,
|
|
22
|
+
"text_color" text DEFAULT '#1f2937' NOT NULL,
|
|
23
|
+
"font_family" text DEFAULT 'system-ui, sans-serif' NOT NULL,
|
|
24
|
+
"heading_font_family" text,
|
|
25
|
+
"button_style" text DEFAULT 'rounded' NOT NULL,
|
|
26
|
+
"button_radius" text DEFAULT '4px' NOT NULL,
|
|
27
|
+
"company_name" text,
|
|
28
|
+
"company_address" text,
|
|
29
|
+
"social_links" jsonb DEFAULT '[]'::jsonb,
|
|
30
|
+
"source_domain" text,
|
|
31
|
+
"auto_extracted" boolean DEFAULT false NOT NULL,
|
|
32
|
+
"is_default" boolean DEFAULT false NOT NULL,
|
|
33
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
34
|
+
"updated_at" timestamp DEFAULT now() NOT NULL
|
|
35
|
+
);
|
|
36
|
+
--> statement-breakpoint
|
|
37
|
+
CREATE TABLE "reusable_block" (
|
|
38
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
39
|
+
"organization_id" text NOT NULL,
|
|
40
|
+
"name" text NOT NULL,
|
|
41
|
+
"description" text,
|
|
42
|
+
"category" text DEFAULT 'custom' NOT NULL,
|
|
43
|
+
"content" jsonb NOT NULL,
|
|
44
|
+
"thumbnail" text,
|
|
45
|
+
"is_public" boolean DEFAULT false NOT NULL,
|
|
46
|
+
"usage_count" integer DEFAULT 0 NOT NULL,
|
|
47
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
48
|
+
"updated_at" timestamp DEFAULT now() NOT NULL,
|
|
49
|
+
"created_by" text NOT NULL
|
|
50
|
+
);
|
|
51
|
+
--> statement-breakpoint
|
|
52
|
+
CREATE TABLE "template" (
|
|
53
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
54
|
+
"organization_id" text NOT NULL,
|
|
55
|
+
"name" text NOT NULL,
|
|
56
|
+
"description" text,
|
|
57
|
+
"subject" text,
|
|
58
|
+
"content" jsonb NOT NULL,
|
|
59
|
+
"compiled_html" text,
|
|
60
|
+
"compiled_text" text,
|
|
61
|
+
"variables" jsonb DEFAULT '[]'::jsonb,
|
|
62
|
+
"test_data" jsonb DEFAULT '{}'::jsonb,
|
|
63
|
+
"room_id" text,
|
|
64
|
+
"is_collaborative" boolean DEFAULT false NOT NULL,
|
|
65
|
+
"ai_generated" boolean DEFAULT false NOT NULL,
|
|
66
|
+
"ai_conversation_id" text,
|
|
67
|
+
"ses_template_name" text,
|
|
68
|
+
"published_at" timestamp,
|
|
69
|
+
"status" "template_status" DEFAULT 'DRAFT' NOT NULL,
|
|
70
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
71
|
+
"updated_at" timestamp DEFAULT now() NOT NULL,
|
|
72
|
+
"created_by" text NOT NULL,
|
|
73
|
+
"last_edited_by" text
|
|
74
|
+
);
|
|
75
|
+
--> statement-breakpoint
|
|
76
|
+
CREATE TABLE "template_variable" (
|
|
77
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
78
|
+
"organization_id" text NOT NULL,
|
|
79
|
+
"name" text NOT NULL,
|
|
80
|
+
"label" text NOT NULL,
|
|
81
|
+
"type" "variable_type" NOT NULL,
|
|
82
|
+
"required" boolean DEFAULT false NOT NULL,
|
|
83
|
+
"fallback" text,
|
|
84
|
+
"validation" jsonb,
|
|
85
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
86
|
+
"updated_at" timestamp DEFAULT now() NOT NULL
|
|
87
|
+
);
|
|
88
|
+
--> statement-breakpoint
|
|
89
|
+
CREATE TABLE "template_version" (
|
|
90
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
91
|
+
"template_id" text NOT NULL,
|
|
92
|
+
"content" jsonb NOT NULL,
|
|
93
|
+
"version" integer NOT NULL,
|
|
94
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
95
|
+
"created_by" text NOT NULL,
|
|
96
|
+
"change_note" text
|
|
97
|
+
);
|
|
98
|
+
--> statement-breakpoint
|
|
99
|
+
ALTER TABLE "ai_conversation" ADD CONSTRAINT "ai_conversation_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
100
|
+
ALTER TABLE "ai_conversation" ADD CONSTRAINT "ai_conversation_template_id_template_id_fk" FOREIGN KEY ("template_id") REFERENCES "public"."template"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
101
|
+
ALTER TABLE "ai_conversation" ADD CONSTRAINT "ai_conversation_created_by_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
102
|
+
ALTER TABLE "brand_kit" ADD CONSTRAINT "brand_kit_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
103
|
+
ALTER TABLE "reusable_block" ADD CONSTRAINT "reusable_block_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
104
|
+
ALTER TABLE "reusable_block" ADD CONSTRAINT "reusable_block_created_by_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
105
|
+
ALTER TABLE "template" ADD CONSTRAINT "template_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
106
|
+
ALTER TABLE "template" ADD CONSTRAINT "template_created_by_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
107
|
+
ALTER TABLE "template" ADD CONSTRAINT "template_last_edited_by_user_id_fk" FOREIGN KEY ("last_edited_by") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
108
|
+
ALTER TABLE "template_variable" ADD CONSTRAINT "template_variable_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
109
|
+
ALTER TABLE "template_version" ADD CONSTRAINT "template_version_template_id_template_id_fk" FOREIGN KEY ("template_id") REFERENCES "public"."template"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
110
|
+
ALTER TABLE "template_version" ADD CONSTRAINT "template_version_created_by_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
111
|
+
CREATE INDEX "ai_conversation_org_idx" ON "ai_conversation" USING btree ("organization_id");--> statement-breakpoint
|
|
112
|
+
CREATE INDEX "ai_conversation_template_idx" ON "ai_conversation" USING btree ("template_id");--> statement-breakpoint
|
|
113
|
+
CREATE INDEX "brand_kit_org_idx" ON "brand_kit" USING btree ("organization_id");--> statement-breakpoint
|
|
114
|
+
CREATE INDEX "brand_kit_default_idx" ON "brand_kit" USING btree ("organization_id","is_default");--> statement-breakpoint
|
|
115
|
+
CREATE INDEX "reusable_block_org_idx" ON "reusable_block" USING btree ("organization_id");--> statement-breakpoint
|
|
116
|
+
CREATE INDEX "reusable_block_created_by_category_idx" ON "reusable_block" USING btree ("created_by","category");--> statement-breakpoint
|
|
117
|
+
CREATE INDEX "reusable_block_public_category_idx" ON "reusable_block" USING btree ("is_public","category");--> statement-breakpoint
|
|
118
|
+
CREATE INDEX "template_org_idx" ON "template" USING btree ("organization_id");--> statement-breakpoint
|
|
119
|
+
CREATE INDEX "template_status_updated_at_idx" ON "template" USING btree ("status","updated_at");--> statement-breakpoint
|
|
120
|
+
CREATE INDEX "template_created_by_idx" ON "template" USING btree ("created_by");--> statement-breakpoint
|
|
121
|
+
CREATE UNIQUE INDEX "template_room_id_idx" ON "template" USING btree ("room_id");--> statement-breakpoint
|
|
122
|
+
CREATE UNIQUE INDEX "template_variable_org_name_idx" ON "template_variable" USING btree ("organization_id","name");--> statement-breakpoint
|
|
123
|
+
CREATE UNIQUE INDEX "template_version_template_version_idx" ON "template_version" USING btree ("template_id","version");--> statement-breakpoint
|
|
124
|
+
CREATE INDEX "template_version_template_created_at_idx" ON "template_version" USING btree ("template_id","created_at");
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
CREATE TABLE "ai_usage_log" (
|
|
2
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"organization_id" text NOT NULL,
|
|
4
|
+
"user_id" text,
|
|
5
|
+
"period_key" text NOT NULL,
|
|
6
|
+
"feature_type" text DEFAULT 'ai_chat' NOT NULL,
|
|
7
|
+
"template_id" text,
|
|
8
|
+
"input_tokens" integer,
|
|
9
|
+
"output_tokens" integer,
|
|
10
|
+
"total_tokens" integer,
|
|
11
|
+
"model" text,
|
|
12
|
+
"duration_ms" integer,
|
|
13
|
+
"created_at" timestamp DEFAULT now() NOT NULL
|
|
14
|
+
);
|
|
15
|
+
--> statement-breakpoint
|
|
16
|
+
CREATE TABLE "ai_usage_monthly" (
|
|
17
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
18
|
+
"organization_id" text NOT NULL,
|
|
19
|
+
"period_key" text NOT NULL,
|
|
20
|
+
"message_count" integer DEFAULT 0 NOT NULL,
|
|
21
|
+
"updated_at" timestamp DEFAULT now() NOT NULL
|
|
22
|
+
);
|
|
23
|
+
--> statement-breakpoint
|
|
24
|
+
ALTER TABLE "ai_usage_log" ADD CONSTRAINT "ai_usage_log_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
25
|
+
ALTER TABLE "ai_usage_log" ADD CONSTRAINT "ai_usage_log_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
26
|
+
ALTER TABLE "ai_usage_monthly" ADD CONSTRAINT "ai_usage_monthly_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
27
|
+
CREATE INDEX "ai_usage_log_org_idx" ON "ai_usage_log" USING btree ("organization_id");--> statement-breakpoint
|
|
28
|
+
CREATE INDEX "ai_usage_log_period_idx" ON "ai_usage_log" USING btree ("period_key");--> statement-breakpoint
|
|
29
|
+
CREATE INDEX "ai_usage_log_org_period_idx" ON "ai_usage_log" USING btree ("organization_id","period_key");--> statement-breakpoint
|
|
30
|
+
CREATE INDEX "ai_usage_log_user_idx" ON "ai_usage_log" USING btree ("user_id");--> statement-breakpoint
|
|
31
|
+
CREATE INDEX "ai_usage_log_created_idx" ON "ai_usage_log" USING btree ("created_at");--> statement-breakpoint
|
|
32
|
+
CREATE UNIQUE INDEX "ai_usage_monthly_org_period_idx" ON "ai_usage_monthly" USING btree ("organization_id","period_key");--> statement-breakpoint
|
|
33
|
+
CREATE INDEX "ai_usage_monthly_period_idx" ON "ai_usage_monthly" USING btree ("period_key");
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
CREATE TABLE "contact" (
|
|
2
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"organization_id" text NOT NULL,
|
|
4
|
+
"email" text NOT NULL,
|
|
5
|
+
"email_hash" text NOT NULL,
|
|
6
|
+
"status" text DEFAULT 'active' NOT NULL,
|
|
7
|
+
"properties" json DEFAULT '{}'::json NOT NULL,
|
|
8
|
+
"last_activity_at" timestamp,
|
|
9
|
+
"last_email_sent_at" timestamp,
|
|
10
|
+
"last_email_opened_at" timestamp,
|
|
11
|
+
"last_email_clicked_at" timestamp,
|
|
12
|
+
"emails_sent" integer DEFAULT 0 NOT NULL,
|
|
13
|
+
"emails_opened" integer DEFAULT 0 NOT NULL,
|
|
14
|
+
"emails_clicked" integer DEFAULT 0 NOT NULL,
|
|
15
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
16
|
+
"updated_at" timestamp DEFAULT now() NOT NULL,
|
|
17
|
+
"confirmed_at" timestamp,
|
|
18
|
+
"unsubscribed_at" timestamp,
|
|
19
|
+
"bounced_at" timestamp,
|
|
20
|
+
"complained_at" timestamp,
|
|
21
|
+
"created_by" text
|
|
22
|
+
);
|
|
23
|
+
--> statement-breakpoint
|
|
24
|
+
CREATE TABLE "contact_topic" (
|
|
25
|
+
"contact_id" text NOT NULL,
|
|
26
|
+
"topic_id" text NOT NULL,
|
|
27
|
+
"status" text DEFAULT 'subscribed' NOT NULL,
|
|
28
|
+
"subscribed_at" timestamp DEFAULT now(),
|
|
29
|
+
"unsubscribed_at" timestamp,
|
|
30
|
+
CONSTRAINT "contact_topic_contact_id_topic_id_pk" PRIMARY KEY("contact_id","topic_id")
|
|
31
|
+
);
|
|
32
|
+
--> statement-breakpoint
|
|
33
|
+
CREATE TABLE "topic" (
|
|
34
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
35
|
+
"organization_id" text NOT NULL,
|
|
36
|
+
"name" text NOT NULL,
|
|
37
|
+
"slug" text NOT NULL,
|
|
38
|
+
"description" text,
|
|
39
|
+
"public" boolean DEFAULT true NOT NULL,
|
|
40
|
+
"double_opt_in" boolean DEFAULT false NOT NULL,
|
|
41
|
+
"subscriber_count" integer DEFAULT 0 NOT NULL,
|
|
42
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
43
|
+
"updated_at" timestamp DEFAULT now() NOT NULL,
|
|
44
|
+
"created_by" text
|
|
45
|
+
);
|
|
46
|
+
--> statement-breakpoint
|
|
47
|
+
CREATE TABLE "waitlist" (
|
|
48
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
49
|
+
"email" text NOT NULL,
|
|
50
|
+
"email_hash" text NOT NULL,
|
|
51
|
+
"product" text NOT NULL,
|
|
52
|
+
"source" text,
|
|
53
|
+
"referrer" text,
|
|
54
|
+
"created_at" timestamp DEFAULT now() NOT NULL
|
|
55
|
+
);
|
|
56
|
+
--> statement-breakpoint
|
|
57
|
+
ALTER TABLE "contact" ADD CONSTRAINT "contact_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
58
|
+
ALTER TABLE "contact" ADD CONSTRAINT "contact_created_by_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
59
|
+
ALTER TABLE "contact_topic" ADD CONSTRAINT "contact_topic_contact_id_contact_id_fk" FOREIGN KEY ("contact_id") REFERENCES "public"."contact"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
60
|
+
ALTER TABLE "contact_topic" ADD CONSTRAINT "contact_topic_topic_id_topic_id_fk" FOREIGN KEY ("topic_id") REFERENCES "public"."topic"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
61
|
+
ALTER TABLE "topic" ADD CONSTRAINT "topic_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
62
|
+
ALTER TABLE "topic" ADD CONSTRAINT "topic_created_by_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
63
|
+
CREATE INDEX "contact_org_idx" ON "contact" USING btree ("organization_id");--> statement-breakpoint
|
|
64
|
+
CREATE INDEX "contact_email_idx" ON "contact" USING btree ("email");--> statement-breakpoint
|
|
65
|
+
CREATE UNIQUE INDEX "contact_unique_org_email_idx" ON "contact" USING btree ("organization_id","email_hash");--> statement-breakpoint
|
|
66
|
+
CREATE INDEX "contact_status_idx" ON "contact" USING btree ("organization_id","status");--> statement-breakpoint
|
|
67
|
+
CREATE INDEX "contact_topic_topic_idx" ON "contact_topic" USING btree ("topic_id");--> statement-breakpoint
|
|
68
|
+
CREATE INDEX "contact_topic_status_idx" ON "contact_topic" USING btree ("topic_id","status");--> statement-breakpoint
|
|
69
|
+
CREATE INDEX "topic_org_idx" ON "topic" USING btree ("organization_id");--> statement-breakpoint
|
|
70
|
+
CREATE UNIQUE INDEX "topic_unique_org_slug_idx" ON "topic" USING btree ("organization_id","slug");--> statement-breakpoint
|
|
71
|
+
CREATE UNIQUE INDEX "waitlist_email_product_idx" ON "waitlist" USING btree ("email_hash","product");--> statement-breakpoint
|
|
72
|
+
CREATE INDEX "waitlist_product_idx" ON "waitlist" USING btree ("product");--> statement-breakpoint
|
|
73
|
+
CREATE INDEX "waitlist_created_at_idx" ON "waitlist" USING btree ("created_at");
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
CREATE TABLE "segment" (
|
|
2
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"organization_id" text NOT NULL,
|
|
4
|
+
"name" text NOT NULL,
|
|
5
|
+
"description" text,
|
|
6
|
+
"condition" json NOT NULL,
|
|
7
|
+
"track_membership" boolean DEFAULT false NOT NULL,
|
|
8
|
+
"member_count" integer DEFAULT 0 NOT NULL,
|
|
9
|
+
"last_computed_at" timestamp,
|
|
10
|
+
"created_by" text,
|
|
11
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
12
|
+
"updated_at" timestamp DEFAULT now() NOT NULL
|
|
13
|
+
);
|
|
14
|
+
--> statement-breakpoint
|
|
15
|
+
ALTER TABLE "segment" ADD CONSTRAINT "segment_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
16
|
+
ALTER TABLE "segment" ADD CONSTRAINT "segment_created_by_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
17
|
+
CREATE INDEX "segment_org_idx" ON "segment" USING btree ("organization_id");--> statement-breakpoint
|
|
18
|
+
CREATE INDEX "segment_name_idx" ON "segment" USING btree ("organization_id","name");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "aws_account" ADD COLUMN "sms_event_history_enabled" boolean DEFAULT false NOT NULL;
|