superceo 0.3.3 → 0.3.5
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/README.md +2 -2
- package/dist/index.js +91 -51
- package/dist/index.js.map +3 -3
- 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/0024_far_beast.sql +2 -0
- package/dist/migrations/0025_nasty_salo.sql +15 -0
- package/dist/migrations/0026_lying_pete_wisdom.sql +39 -0
- package/dist/migrations/0027_tranquil_tenebrous.sql +2 -0
- package/dist/migrations/0028_harsh_goliath.sql +54 -0
- package/dist/migrations/0029_plugin_tables.sql +177 -0
- package/dist/migrations/0030_rich_magneto.sql +12 -0
- package/dist/migrations/0031_zippy_magma.sql +51 -0
- package/dist/migrations/0032_pretty_doctor_octopus.sql +102 -0
- package/dist/migrations/0033_shiny_black_tarantula.sql +2 -0
- package/dist/migrations/0034_fat_dormammu.sql +2 -0
- package/dist/migrations/0035_marvelous_satana.sql +91 -0
- package/dist/migrations/0036_cheerful_nitro.sql +9 -0
- package/dist/migrations/0037_friendly_eddie_brock.sql +29 -0
- package/dist/migrations/0038_careless_iron_monger.sql +5 -0
- package/dist/migrations/0039_fat_magneto.sql +161 -0
- package/dist/migrations/0040_eager_shotgun.sql +5 -0
- package/dist/migrations/0041_curly_maria_hill.sql +1 -0
- package/dist/migrations/0042_spotty_the_renegades.sql +26 -0
- package/dist/migrations/0043_reflective_captain_universe.sql +6 -0
- package/dist/migrations/0044_illegal_toad.sql +56 -0
- package/dist/migrations/0045_workable_shockwave.sql +17 -0
- package/dist/migrations/0046_smooth_sentinels.sql +11 -0
- package/dist/migrations/0047_overjoyed_groot.sql +102 -0
- package/dist/migrations/0048_flashy_marrow.sql +1 -0
- package/dist/migrations/0049_flawless_abomination.sql +21 -0
- package/dist/migrations/0050_stiff_luckman.sql +1 -0
- package/dist/migrations/0051_young_korg.sql +5 -0
- package/dist/migrations/0052_mushy_trauma.sql +26 -0
- package/dist/migrations/0053_sharp_wild_child.sql +18 -0
- package/dist/migrations/0054_draft_routines.sql +2 -0
- package/dist/migrations/0055_faithful_doctor_octopus.sql +48 -0
- package/dist/migrations/0056_equal_sabretooth.sql +34 -0
- package/dist/migrations/0057_ordinary_khan.sql +5 -0
- package/dist/migrations/0058_sad_wolf_cub.sql +2 -0
- package/dist/migrations/0059_rich_jackpot.sql +4 -0
- package/dist/migrations/0060_orange_nightshade.sql +60 -0
- package/dist/migrations/0061_parallel_puma.sql +1 -0
- package/dist/migrations/0062_goofy_lethal_legion.sql +26 -0
- package/dist/migrations/0063_luxuriant_doctor_spectrum.sql +23 -0
- package/dist/migrations/0064_lead_platform_user.sql +2 -0
- package/dist/migrations/0065_wild_next_avengers.sql +14 -0
- package/dist/migrations/0066_late_stark_industries.sql +5 -0
- package/dist/migrations/0067_instance_backup_settings.sql +1 -0
- package/dist/migrations/0068_tiresome_ma_gnuci.sql +1 -0
- package/dist/migrations/0069_lazy_zaladane.sql +106 -0
- package/dist/migrations/0070_lame_wendigo.sql +1 -0
- package/dist/migrations/0071_content_analytics.sql +71 -0
- package/dist/migrations/0072_quota_gate_feature_scope.sql +3 -0
- package/dist/migrations/0073_instance_update_settings.sql +1 -0
- package/dist/migrations/0074_local_tools_config.sql +1 -0
- package/dist/migrations/0075_liveness_recovery_dedupe.sql +15 -0
- package/dist/migrations/0076_active_run_output_watchdog.sql +91 -0
- package/dist/migrations/0077_issue_tree_holds.sql +107 -0
- package/dist/migrations/0078_issue_reference_mentions.sql +50 -0
- package/dist/migrations/0079_subscription_quota_lane.sql +4 -0
- package/dist/migrations/0080_lead_product_user.sql +3 -0
- package/dist/migrations/0081_lead_product_user_split_x.sql +8 -0
- package/dist/migrations/0082_agent_image_url.sql +1 -0
- package/dist/migrations/0083_chat_sessions_target_agent.sql +2 -0
- package/dist/migrations/0084_document_folders.sql +22 -0
- package/dist/migrations/0085_eager_mulholland_black.sql +4 -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/0024_snapshot.json +5693 -0
- package/dist/migrations/meta/0025_snapshot.json +5849 -0
- package/dist/migrations/meta/0027_snapshot.json +6205 -0
- package/dist/migrations/meta/0028_snapshot.json +6710 -0
- package/dist/migrations/meta/0029_snapshot.json +7899 -0
- package/dist/migrations/meta/0030_snapshot.json +8003 -0
- package/dist/migrations/meta/0031_snapshot.json +7242 -0
- package/dist/migrations/meta/0032_snapshot.json +7733 -0
- package/dist/migrations/meta/0033_snapshot.json +9038 -0
- package/dist/migrations/meta/0034_snapshot.json +9039 -0
- package/dist/migrations/meta/0035_snapshot.json +9959 -0
- package/dist/migrations/meta/0036_snapshot.json +10023 -0
- package/dist/migrations/meta/0037_snapshot.json +10263 -0
- package/dist/migrations/meta/0038_snapshot.json +11350 -0
- package/dist/migrations/meta/0039_snapshot.json +10308 -0
- package/dist/migrations/meta/0040_snapshot.json +10481 -0
- package/dist/migrations/meta/0041_snapshot.json +11393 -0
- package/dist/migrations/meta/0044_snapshot.json +11701 -0
- package/dist/migrations/meta/0045_snapshot.json +11857 -0
- package/dist/migrations/meta/0046_snapshot.json +11870 -0
- package/dist/migrations/meta/0047_snapshot.json +12539 -0
- package/dist/migrations/meta/0048_snapshot.json +12546 -0
- package/dist/migrations/meta/0049_snapshot.json +12766 -0
- package/dist/migrations/meta/0050_snapshot.json +12772 -0
- package/dist/migrations/meta/0051_snapshot.json +12836 -0
- package/dist/migrations/meta/0052_snapshot.json +13057 -0
- package/dist/migrations/meta/0053_snapshot.json +12979 -0
- package/dist/migrations/meta/0055_snapshot.json +13586 -0
- package/dist/migrations/meta/0056_snapshot.json +13868 -0
- package/dist/migrations/meta/0057_snapshot.json +13906 -0
- package/dist/migrations/meta/0058_snapshot.json +13918 -0
- package/dist/migrations/meta/0059_snapshot.json +13942 -0
- package/dist/migrations/meta/0060_snapshot.json +14509 -0
- package/dist/migrations/meta/0061_snapshot.json +14515 -0
- package/dist/migrations/meta/0062_snapshot.json +14717 -0
- package/dist/migrations/meta/0063_snapshot.json +14941 -0
- package/dist/migrations/meta/0065_snapshot.json +15081 -0
- package/dist/migrations/meta/0066_snapshot.json +15112 -0
- package/dist/migrations/meta/0067_snapshot.json +15119 -0
- package/dist/migrations/meta/0068_snapshot.json +15125 -0
- package/dist/migrations/meta/0069_snapshot.json +16110 -0
- package/dist/migrations/meta/0070_snapshot.json +16116 -0
- package/dist/migrations/meta/0073_snapshot.json +16584 -0
- package/dist/migrations/meta/0079_snapshot.json +17847 -0
- package/dist/migrations/meta/0080_snapshot.json +17853 -0
- package/dist/migrations/meta/0081_snapshot.json +17853 -0
- package/dist/migrations/meta/0085_snapshot.json +18068 -0
- package/dist/migrations/meta/_journal.json +608 -0
- package/package.json +4 -4
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
CREATE TABLE "content_analytics_platform_configs" (
|
|
2
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
3
|
+
"company_id" uuid NOT NULL,
|
|
4
|
+
"platform" text NOT NULL,
|
|
5
|
+
"provider_key" text NOT NULL,
|
|
6
|
+
"env" jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
7
|
+
"enabled" boolean DEFAULT true NOT NULL,
|
|
8
|
+
"last_test_at" timestamp with time zone,
|
|
9
|
+
"last_test_status" text,
|
|
10
|
+
"last_test_error" text,
|
|
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
|
+
CREATE TABLE "content_analytics_snapshots" (
|
|
16
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
17
|
+
"company_id" uuid NOT NULL,
|
|
18
|
+
"content_id" uuid NOT NULL,
|
|
19
|
+
"platform" text NOT NULL,
|
|
20
|
+
"provider_key" text NOT NULL,
|
|
21
|
+
"status" text DEFAULT 'idle' NOT NULL,
|
|
22
|
+
"fetched_at" timestamp with time zone,
|
|
23
|
+
"metrics" jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
24
|
+
"raw" jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
25
|
+
"meta" jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
26
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
27
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
28
|
+
);
|
|
29
|
+
--> statement-breakpoint
|
|
30
|
+
CREATE TABLE "content_analytics_fetch_logs" (
|
|
31
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
32
|
+
"company_id" uuid NOT NULL,
|
|
33
|
+
"content_id" uuid NOT NULL,
|
|
34
|
+
"platform" text NOT NULL,
|
|
35
|
+
"provider_key" text NOT NULL,
|
|
36
|
+
"status" text NOT NULL,
|
|
37
|
+
"started_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
38
|
+
"finished_at" timestamp with time zone,
|
|
39
|
+
"duration_ms" integer,
|
|
40
|
+
"error" text,
|
|
41
|
+
"summary" text,
|
|
42
|
+
"request_meta" jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
43
|
+
"response_meta" jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
44
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
45
|
+
);
|
|
46
|
+
--> statement-breakpoint
|
|
47
|
+
ALTER TABLE "content_analytics_platform_configs" ADD CONSTRAINT "content_analytics_platform_configs_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE cascade ON UPDATE no action;
|
|
48
|
+
--> statement-breakpoint
|
|
49
|
+
ALTER TABLE "content_analytics_snapshots" ADD CONSTRAINT "content_analytics_snapshots_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE cascade ON UPDATE no action;
|
|
50
|
+
--> statement-breakpoint
|
|
51
|
+
ALTER TABLE "content_analytics_snapshots" ADD CONSTRAINT "content_analytics_snapshots_content_id_contents_id_fk" FOREIGN KEY ("content_id") REFERENCES "public"."contents"("id") ON DELETE cascade ON UPDATE no action;
|
|
52
|
+
--> statement-breakpoint
|
|
53
|
+
ALTER TABLE "content_analytics_fetch_logs" ADD CONSTRAINT "content_analytics_fetch_logs_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE cascade ON UPDATE no action;
|
|
54
|
+
--> statement-breakpoint
|
|
55
|
+
ALTER TABLE "content_analytics_fetch_logs" ADD CONSTRAINT "content_analytics_fetch_logs_content_id_contents_id_fk" FOREIGN KEY ("content_id") REFERENCES "public"."contents"("id") ON DELETE cascade ON UPDATE no action;
|
|
56
|
+
--> statement-breakpoint
|
|
57
|
+
CREATE UNIQUE INDEX "content_analytics_platform_cfg_company_platform_uq" ON "content_analytics_platform_configs" USING btree ("company_id","platform");
|
|
58
|
+
--> statement-breakpoint
|
|
59
|
+
CREATE INDEX "content_analytics_platform_cfg_company_idx" ON "content_analytics_platform_configs" USING btree ("company_id");
|
|
60
|
+
--> statement-breakpoint
|
|
61
|
+
CREATE INDEX "content_analytics_platform_cfg_platform_idx" ON "content_analytics_platform_configs" USING btree ("platform");
|
|
62
|
+
--> statement-breakpoint
|
|
63
|
+
CREATE UNIQUE INDEX "content_analytics_snapshots_content_uq" ON "content_analytics_snapshots" USING btree ("content_id");
|
|
64
|
+
--> statement-breakpoint
|
|
65
|
+
CREATE INDEX "content_analytics_snapshots_company_idx" ON "content_analytics_snapshots" USING btree ("company_id");
|
|
66
|
+
--> statement-breakpoint
|
|
67
|
+
CREATE INDEX "content_analytics_snapshots_platform_idx" ON "content_analytics_snapshots" USING btree ("platform");
|
|
68
|
+
--> statement-breakpoint
|
|
69
|
+
CREATE INDEX "content_analytics_fetch_logs_content_idx" ON "content_analytics_fetch_logs" USING btree ("content_id","created_at");
|
|
70
|
+
--> statement-breakpoint
|
|
71
|
+
CREATE INDEX "content_analytics_fetch_logs_company_idx" ON "content_analytics_fetch_logs" USING btree ("company_id");
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
ALTER TABLE "budget_policies" ADD COLUMN "feature_scope" text;--> statement-breakpoint
|
|
2
|
+
DROP INDEX IF EXISTS "budget_policies_company_scope_metric_unique_idx";--> statement-breakpoint
|
|
3
|
+
ALTER TABLE "budget_policies" ADD CONSTRAINT "budget_policies_company_scope_metric_unique_idx" UNIQUE NULLS NOT DISTINCT ("company_id","scope_type","scope_id","metric","window_kind","feature_scope");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "instance_settings" ADD COLUMN "updates" jsonb DEFAULT '{}'::jsonb NOT NULL;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "instance_settings" ADD COLUMN "local_tools" jsonb NOT NULL DEFAULT '{}'::jsonb;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ALTER TABLE "issues" ADD COLUMN IF NOT EXISTS "origin_fingerprint" text DEFAULT 'default' NOT NULL;
|
|
2
|
+
--> statement-breakpoint
|
|
3
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "issues_active_liveness_recovery_incident_uq"
|
|
4
|
+
ON "issues" USING btree ("company_id","origin_kind","origin_id")
|
|
5
|
+
WHERE "origin_kind" = 'harness_liveness_escalation'
|
|
6
|
+
AND "origin_id" IS NOT NULL
|
|
7
|
+
AND "hidden_at" IS NULL
|
|
8
|
+
AND "status" NOT IN ('done', 'cancelled');
|
|
9
|
+
--> statement-breakpoint
|
|
10
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "issues_active_liveness_recovery_leaf_uq"
|
|
11
|
+
ON "issues" USING btree ("company_id","origin_kind","origin_fingerprint")
|
|
12
|
+
WHERE "origin_kind" = 'harness_liveness_escalation'
|
|
13
|
+
AND "origin_fingerprint" <> 'default'
|
|
14
|
+
AND "hidden_at" IS NULL
|
|
15
|
+
AND "status" NOT IN ('done', 'cancelled');
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
ALTER TABLE "heartbeat_runs" ADD COLUMN IF NOT EXISTS "process_group_id" integer;
|
|
2
|
+
--> statement-breakpoint
|
|
3
|
+
ALTER TABLE "heartbeat_runs" ADD COLUMN IF NOT EXISTS "last_output_at" timestamp with time zone;
|
|
4
|
+
--> statement-breakpoint
|
|
5
|
+
ALTER TABLE "heartbeat_runs" ADD COLUMN IF NOT EXISTS "last_output_seq" integer DEFAULT 0 NOT NULL;
|
|
6
|
+
--> statement-breakpoint
|
|
7
|
+
ALTER TABLE "heartbeat_runs" ADD COLUMN IF NOT EXISTS "last_output_stream" text;
|
|
8
|
+
--> statement-breakpoint
|
|
9
|
+
ALTER TABLE "heartbeat_runs" ADD COLUMN IF NOT EXISTS "last_output_bytes" bigint;
|
|
10
|
+
--> statement-breakpoint
|
|
11
|
+
ALTER TABLE "heartbeat_runs" ADD COLUMN IF NOT EXISTS "scheduled_retry_at" timestamp with time zone;
|
|
12
|
+
--> statement-breakpoint
|
|
13
|
+
ALTER TABLE "heartbeat_runs" ADD COLUMN IF NOT EXISTS "scheduled_retry_attempt" integer DEFAULT 0 NOT NULL;
|
|
14
|
+
--> statement-breakpoint
|
|
15
|
+
ALTER TABLE "heartbeat_runs" ADD COLUMN IF NOT EXISTS "scheduled_retry_reason" text;
|
|
16
|
+
--> statement-breakpoint
|
|
17
|
+
ALTER TABLE "heartbeat_runs" ADD COLUMN IF NOT EXISTS "liveness_state" text;
|
|
18
|
+
--> statement-breakpoint
|
|
19
|
+
ALTER TABLE "heartbeat_runs" ADD COLUMN IF NOT EXISTS "liveness_reason" text;
|
|
20
|
+
--> statement-breakpoint
|
|
21
|
+
ALTER TABLE "heartbeat_runs" ADD COLUMN IF NOT EXISTS "continuation_attempt" integer DEFAULT 0 NOT NULL;
|
|
22
|
+
--> statement-breakpoint
|
|
23
|
+
ALTER TABLE "heartbeat_runs" ADD COLUMN IF NOT EXISTS "last_useful_action_at" timestamp with time zone;
|
|
24
|
+
--> statement-breakpoint
|
|
25
|
+
ALTER TABLE "heartbeat_runs" ADD COLUMN IF NOT EXISTS "next_action" text;
|
|
26
|
+
--> statement-breakpoint
|
|
27
|
+
CREATE INDEX IF NOT EXISTS "heartbeat_runs_company_liveness_idx"
|
|
28
|
+
ON "heartbeat_runs" USING btree ("company_id","liveness_state","created_at");
|
|
29
|
+
--> statement-breakpoint
|
|
30
|
+
CREATE INDEX IF NOT EXISTS "heartbeat_runs_company_status_last_output_idx"
|
|
31
|
+
ON "heartbeat_runs" USING btree ("company_id","status","last_output_at");
|
|
32
|
+
--> statement-breakpoint
|
|
33
|
+
CREATE INDEX IF NOT EXISTS "heartbeat_runs_company_status_process_started_idx"
|
|
34
|
+
ON "heartbeat_runs" USING btree ("company_id","status","process_started_at");
|
|
35
|
+
--> statement-breakpoint
|
|
36
|
+
CREATE TABLE IF NOT EXISTS "heartbeat_run_watchdog_decisions" (
|
|
37
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
38
|
+
"company_id" uuid NOT NULL,
|
|
39
|
+
"run_id" uuid NOT NULL,
|
|
40
|
+
"evaluation_issue_id" uuid,
|
|
41
|
+
"decision" text NOT NULL,
|
|
42
|
+
"snoozed_until" timestamp with time zone,
|
|
43
|
+
"reason" text,
|
|
44
|
+
"created_by_agent_id" uuid,
|
|
45
|
+
"created_by_user_id" text,
|
|
46
|
+
"created_by_run_id" uuid,
|
|
47
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
48
|
+
);
|
|
49
|
+
--> statement-breakpoint
|
|
50
|
+
DO $$ BEGIN
|
|
51
|
+
ALTER TABLE "heartbeat_run_watchdog_decisions" ADD CONSTRAINT "heartbeat_run_watchdog_decisions_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE no action ON UPDATE no action;
|
|
52
|
+
EXCEPTION
|
|
53
|
+
WHEN duplicate_object THEN null;
|
|
54
|
+
END $$;
|
|
55
|
+
--> statement-breakpoint
|
|
56
|
+
DO $$ BEGIN
|
|
57
|
+
ALTER TABLE "heartbeat_run_watchdog_decisions" ADD CONSTRAINT "heartbeat_run_watchdog_decisions_run_id_heartbeat_runs_id_fk" FOREIGN KEY ("run_id") REFERENCES "public"."heartbeat_runs"("id") ON DELETE cascade ON UPDATE no action;
|
|
58
|
+
EXCEPTION
|
|
59
|
+
WHEN duplicate_object THEN null;
|
|
60
|
+
END $$;
|
|
61
|
+
--> statement-breakpoint
|
|
62
|
+
DO $$ BEGIN
|
|
63
|
+
ALTER TABLE "heartbeat_run_watchdog_decisions" ADD CONSTRAINT "heartbeat_run_watchdog_decisions_evaluation_issue_id_issues_id_fk" FOREIGN KEY ("evaluation_issue_id") REFERENCES "public"."issues"("id") ON DELETE set null ON UPDATE no action;
|
|
64
|
+
EXCEPTION
|
|
65
|
+
WHEN duplicate_object THEN null;
|
|
66
|
+
END $$;
|
|
67
|
+
--> statement-breakpoint
|
|
68
|
+
DO $$ BEGIN
|
|
69
|
+
ALTER TABLE "heartbeat_run_watchdog_decisions" ADD CONSTRAINT "heartbeat_run_watchdog_decisions_created_by_agent_id_agents_id_fk" FOREIGN KEY ("created_by_agent_id") REFERENCES "public"."agents"("id") ON DELETE set null ON UPDATE no action;
|
|
70
|
+
EXCEPTION
|
|
71
|
+
WHEN duplicate_object THEN null;
|
|
72
|
+
END $$;
|
|
73
|
+
--> statement-breakpoint
|
|
74
|
+
DO $$ BEGIN
|
|
75
|
+
ALTER TABLE "heartbeat_run_watchdog_decisions" ADD CONSTRAINT "heartbeat_run_watchdog_decisions_created_by_run_id_heartbeat_runs_id_fk" FOREIGN KEY ("created_by_run_id") REFERENCES "public"."heartbeat_runs"("id") ON DELETE set null ON UPDATE no action;
|
|
76
|
+
EXCEPTION
|
|
77
|
+
WHEN duplicate_object THEN null;
|
|
78
|
+
END $$;
|
|
79
|
+
--> statement-breakpoint
|
|
80
|
+
CREATE INDEX IF NOT EXISTS "heartbeat_run_watchdog_decisions_company_run_created_idx"
|
|
81
|
+
ON "heartbeat_run_watchdog_decisions" USING btree ("company_id","run_id","created_at");
|
|
82
|
+
--> statement-breakpoint
|
|
83
|
+
CREATE INDEX IF NOT EXISTS "heartbeat_run_watchdog_decisions_company_run_snooze_idx"
|
|
84
|
+
ON "heartbeat_run_watchdog_decisions" USING btree ("company_id","run_id","snoozed_until");
|
|
85
|
+
--> statement-breakpoint
|
|
86
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "issues_active_stale_run_evaluation_uq"
|
|
87
|
+
ON "issues" USING btree ("company_id","origin_kind","origin_id")
|
|
88
|
+
WHERE "origin_kind" = 'stale_active_run_evaluation'
|
|
89
|
+
AND "origin_id" IS NOT NULL
|
|
90
|
+
AND "hidden_at" IS NULL
|
|
91
|
+
AND "status" NOT IN ('done', 'cancelled');
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
CREATE TABLE IF NOT EXISTS "issue_tree_holds" (
|
|
2
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
3
|
+
"company_id" uuid NOT NULL,
|
|
4
|
+
"root_issue_id" uuid NOT NULL,
|
|
5
|
+
"mode" text NOT NULL,
|
|
6
|
+
"status" text DEFAULT 'active' NOT NULL,
|
|
7
|
+
"reason" text,
|
|
8
|
+
"release_policy" jsonb,
|
|
9
|
+
"created_by_actor_type" text DEFAULT 'system' NOT NULL,
|
|
10
|
+
"created_by_agent_id" uuid,
|
|
11
|
+
"created_by_user_id" text,
|
|
12
|
+
"created_by_run_id" uuid,
|
|
13
|
+
"released_at" timestamp with time zone,
|
|
14
|
+
"released_by_actor_type" text,
|
|
15
|
+
"released_by_agent_id" uuid,
|
|
16
|
+
"released_by_user_id" text,
|
|
17
|
+
"released_by_run_id" uuid,
|
|
18
|
+
"release_reason" text,
|
|
19
|
+
"release_metadata" jsonb,
|
|
20
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
21
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
22
|
+
);
|
|
23
|
+
--> statement-breakpoint
|
|
24
|
+
CREATE TABLE IF NOT EXISTS "issue_tree_hold_members" (
|
|
25
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
26
|
+
"company_id" uuid NOT NULL,
|
|
27
|
+
"hold_id" uuid NOT NULL,
|
|
28
|
+
"issue_id" uuid NOT NULL,
|
|
29
|
+
"parent_issue_id" uuid,
|
|
30
|
+
"depth" integer DEFAULT 0 NOT NULL,
|
|
31
|
+
"issue_identifier" text,
|
|
32
|
+
"issue_title" text NOT NULL,
|
|
33
|
+
"issue_status" text NOT NULL,
|
|
34
|
+
"assignee_agent_id" uuid,
|
|
35
|
+
"assignee_user_id" text,
|
|
36
|
+
"active_run_id" uuid,
|
|
37
|
+
"active_run_status" text,
|
|
38
|
+
"skipped" boolean DEFAULT false NOT NULL,
|
|
39
|
+
"skip_reason" text,
|
|
40
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
41
|
+
);
|
|
42
|
+
--> statement-breakpoint
|
|
43
|
+
DO $$ BEGIN
|
|
44
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'issue_tree_holds_company_id_companies_id_fk') THEN
|
|
45
|
+
ALTER TABLE "issue_tree_holds" ADD CONSTRAINT "issue_tree_holds_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE no action ON UPDATE no action;
|
|
46
|
+
END IF;
|
|
47
|
+
END $$;--> statement-breakpoint
|
|
48
|
+
DO $$ BEGIN
|
|
49
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'issue_tree_holds_root_issue_id_issues_id_fk') THEN
|
|
50
|
+
ALTER TABLE "issue_tree_holds" ADD CONSTRAINT "issue_tree_holds_root_issue_id_issues_id_fk" FOREIGN KEY ("root_issue_id") REFERENCES "public"."issues"("id") ON DELETE cascade ON UPDATE no action;
|
|
51
|
+
END IF;
|
|
52
|
+
END $$;--> statement-breakpoint
|
|
53
|
+
DO $$ BEGIN
|
|
54
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'issue_tree_holds_created_by_agent_id_agents_id_fk') THEN
|
|
55
|
+
ALTER TABLE "issue_tree_holds" ADD CONSTRAINT "issue_tree_holds_created_by_agent_id_agents_id_fk" FOREIGN KEY ("created_by_agent_id") REFERENCES "public"."agents"("id") ON DELETE set null ON UPDATE no action;
|
|
56
|
+
END IF;
|
|
57
|
+
END $$;--> statement-breakpoint
|
|
58
|
+
DO $$ BEGIN
|
|
59
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'issue_tree_holds_created_by_run_id_heartbeat_runs_id_fk') THEN
|
|
60
|
+
ALTER TABLE "issue_tree_holds" ADD CONSTRAINT "issue_tree_holds_created_by_run_id_heartbeat_runs_id_fk" FOREIGN KEY ("created_by_run_id") REFERENCES "public"."heartbeat_runs"("id") ON DELETE set null ON UPDATE no action;
|
|
61
|
+
END IF;
|
|
62
|
+
END $$;--> statement-breakpoint
|
|
63
|
+
DO $$ BEGIN
|
|
64
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'issue_tree_holds_released_by_agent_id_agents_id_fk') THEN
|
|
65
|
+
ALTER TABLE "issue_tree_holds" ADD CONSTRAINT "issue_tree_holds_released_by_agent_id_agents_id_fk" FOREIGN KEY ("released_by_agent_id") REFERENCES "public"."agents"("id") ON DELETE set null ON UPDATE no action;
|
|
66
|
+
END IF;
|
|
67
|
+
END $$;--> statement-breakpoint
|
|
68
|
+
DO $$ BEGIN
|
|
69
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'issue_tree_holds_released_by_run_id_heartbeat_runs_id_fk') THEN
|
|
70
|
+
ALTER TABLE "issue_tree_holds" ADD CONSTRAINT "issue_tree_holds_released_by_run_id_heartbeat_runs_id_fk" FOREIGN KEY ("released_by_run_id") REFERENCES "public"."heartbeat_runs"("id") ON DELETE set null ON UPDATE no action;
|
|
71
|
+
END IF;
|
|
72
|
+
END $$;--> statement-breakpoint
|
|
73
|
+
DO $$ BEGIN
|
|
74
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'issue_tree_hold_members_company_id_companies_id_fk') THEN
|
|
75
|
+
ALTER TABLE "issue_tree_hold_members" ADD CONSTRAINT "issue_tree_hold_members_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE no action ON UPDATE no action;
|
|
76
|
+
END IF;
|
|
77
|
+
END $$;--> statement-breakpoint
|
|
78
|
+
DO $$ BEGIN
|
|
79
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'issue_tree_hold_members_hold_id_issue_tree_holds_id_fk') THEN
|
|
80
|
+
ALTER TABLE "issue_tree_hold_members" ADD CONSTRAINT "issue_tree_hold_members_hold_id_issue_tree_holds_id_fk" FOREIGN KEY ("hold_id") REFERENCES "public"."issue_tree_holds"("id") ON DELETE cascade ON UPDATE no action;
|
|
81
|
+
END IF;
|
|
82
|
+
END $$;--> statement-breakpoint
|
|
83
|
+
DO $$ BEGIN
|
|
84
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'issue_tree_hold_members_issue_id_issues_id_fk') THEN
|
|
85
|
+
ALTER TABLE "issue_tree_hold_members" ADD CONSTRAINT "issue_tree_hold_members_issue_id_issues_id_fk" FOREIGN KEY ("issue_id") REFERENCES "public"."issues"("id") ON DELETE cascade ON UPDATE no action;
|
|
86
|
+
END IF;
|
|
87
|
+
END $$;--> statement-breakpoint
|
|
88
|
+
DO $$ BEGIN
|
|
89
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'issue_tree_hold_members_parent_issue_id_issues_id_fk') THEN
|
|
90
|
+
ALTER TABLE "issue_tree_hold_members" ADD CONSTRAINT "issue_tree_hold_members_parent_issue_id_issues_id_fk" FOREIGN KEY ("parent_issue_id") REFERENCES "public"."issues"("id") ON DELETE set null ON UPDATE no action;
|
|
91
|
+
END IF;
|
|
92
|
+
END $$;--> statement-breakpoint
|
|
93
|
+
DO $$ BEGIN
|
|
94
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'issue_tree_hold_members_assignee_agent_id_agents_id_fk') THEN
|
|
95
|
+
ALTER TABLE "issue_tree_hold_members" ADD CONSTRAINT "issue_tree_hold_members_assignee_agent_id_agents_id_fk" FOREIGN KEY ("assignee_agent_id") REFERENCES "public"."agents"("id") ON DELETE set null ON UPDATE no action;
|
|
96
|
+
END IF;
|
|
97
|
+
END $$;--> statement-breakpoint
|
|
98
|
+
DO $$ BEGIN
|
|
99
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'issue_tree_hold_members_active_run_id_heartbeat_runs_id_fk') THEN
|
|
100
|
+
ALTER TABLE "issue_tree_hold_members" ADD CONSTRAINT "issue_tree_hold_members_active_run_id_heartbeat_runs_id_fk" FOREIGN KEY ("active_run_id") REFERENCES "public"."heartbeat_runs"("id") ON DELETE set null ON UPDATE no action;
|
|
101
|
+
END IF;
|
|
102
|
+
END $$;--> statement-breakpoint
|
|
103
|
+
CREATE INDEX IF NOT EXISTS "issue_tree_holds_company_root_status_idx" ON "issue_tree_holds" USING btree ("company_id","root_issue_id","status");--> statement-breakpoint
|
|
104
|
+
CREATE INDEX IF NOT EXISTS "issue_tree_holds_company_status_mode_idx" ON "issue_tree_holds" USING btree ("company_id","status","mode");--> statement-breakpoint
|
|
105
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "issue_tree_hold_members_hold_issue_uq" ON "issue_tree_hold_members" USING btree ("hold_id","issue_id");--> statement-breakpoint
|
|
106
|
+
CREATE INDEX IF NOT EXISTS "issue_tree_hold_members_company_issue_idx" ON "issue_tree_hold_members" USING btree ("company_id","issue_id");--> statement-breakpoint
|
|
107
|
+
CREATE INDEX IF NOT EXISTS "issue_tree_hold_members_hold_depth_idx" ON "issue_tree_hold_members" USING btree ("hold_id","depth");
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
CREATE TABLE IF NOT EXISTS "issue_reference_mentions" (
|
|
2
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
3
|
+
"company_id" uuid NOT NULL,
|
|
4
|
+
"source_issue_id" uuid NOT NULL,
|
|
5
|
+
"target_issue_id" uuid NOT NULL,
|
|
6
|
+
"source_kind" text NOT NULL,
|
|
7
|
+
"source_record_id" uuid,
|
|
8
|
+
"document_key" text,
|
|
9
|
+
"matched_text" text,
|
|
10
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
11
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
12
|
+
);
|
|
13
|
+
--> statement-breakpoint
|
|
14
|
+
DO $$ BEGIN
|
|
15
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'issue_reference_mentions_company_id_companies_id_fk') THEN
|
|
16
|
+
ALTER TABLE "issue_reference_mentions" ADD CONSTRAINT "issue_reference_mentions_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE no action ON UPDATE no action;
|
|
17
|
+
END IF;
|
|
18
|
+
END $$;
|
|
19
|
+
--> statement-breakpoint
|
|
20
|
+
DO $$ BEGIN
|
|
21
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'issue_reference_mentions_source_issue_id_issues_id_fk') THEN
|
|
22
|
+
ALTER TABLE "issue_reference_mentions" ADD CONSTRAINT "issue_reference_mentions_source_issue_id_issues_id_fk" FOREIGN KEY ("source_issue_id") REFERENCES "public"."issues"("id") ON DELETE cascade ON UPDATE no action;
|
|
23
|
+
END IF;
|
|
24
|
+
END $$;
|
|
25
|
+
--> statement-breakpoint
|
|
26
|
+
DO $$ BEGIN
|
|
27
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'issue_reference_mentions_target_issue_id_issues_id_fk') THEN
|
|
28
|
+
ALTER TABLE "issue_reference_mentions" ADD CONSTRAINT "issue_reference_mentions_target_issue_id_issues_id_fk" FOREIGN KEY ("target_issue_id") REFERENCES "public"."issues"("id") ON DELETE cascade ON UPDATE no action;
|
|
29
|
+
END IF;
|
|
30
|
+
END $$;--> statement-breakpoint
|
|
31
|
+
CREATE INDEX IF NOT EXISTS "issue_reference_mentions_company_source_issue_idx" ON "issue_reference_mentions" USING btree ("company_id","source_issue_id");--> statement-breakpoint
|
|
32
|
+
CREATE INDEX IF NOT EXISTS "issue_reference_mentions_company_target_issue_idx" ON "issue_reference_mentions" USING btree ("company_id","target_issue_id");--> statement-breakpoint
|
|
33
|
+
CREATE INDEX IF NOT EXISTS "issue_reference_mentions_company_issue_pair_idx" ON "issue_reference_mentions" USING btree ("company_id","source_issue_id","target_issue_id");--> statement-breakpoint
|
|
34
|
+
DELETE FROM "issue_reference_mentions"
|
|
35
|
+
WHERE "id" IN (
|
|
36
|
+
SELECT "id"
|
|
37
|
+
FROM (
|
|
38
|
+
SELECT
|
|
39
|
+
"id",
|
|
40
|
+
row_number() OVER (
|
|
41
|
+
PARTITION BY "company_id", "source_issue_id", "target_issue_id", "source_kind", "source_record_id"
|
|
42
|
+
ORDER BY "created_at", "id"
|
|
43
|
+
) AS "row_number"
|
|
44
|
+
FROM "issue_reference_mentions"
|
|
45
|
+
) AS "duplicates"
|
|
46
|
+
WHERE "duplicates"."row_number" > 1
|
|
47
|
+
);--> statement-breakpoint
|
|
48
|
+
DROP INDEX IF EXISTS "issue_reference_mentions_company_source_mention_uq";--> statement-breakpoint
|
|
49
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "issue_reference_mentions_company_source_mention_record_uq" ON "issue_reference_mentions" USING btree ("company_id","source_issue_id","target_issue_id","source_kind","source_record_id") WHERE "source_record_id" IS NOT NULL;--> statement-breakpoint
|
|
50
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "issue_reference_mentions_company_source_mention_null_record_uq" ON "issue_reference_mentions" USING btree ("company_id","source_issue_id","target_issue_id","source_kind") WHERE "source_record_id" IS NULL;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
ALTER TABLE "budget_policies" DROP CONSTRAINT IF EXISTS "budget_policies_company_scope_metric_unique_idx";--> statement-breakpoint
|
|
2
|
+
ALTER TABLE "budget_policies" ADD COLUMN IF NOT EXISTS "subscription_quota_lane" text;--> statement-breakpoint
|
|
3
|
+
UPDATE "budget_policies" SET "subscription_quota_lane" = 'any' WHERE "metric" = 'subscription_quota_percent' AND "subscription_quota_lane" IS NULL;--> statement-breakpoint
|
|
4
|
+
ALTER TABLE "budget_policies" ADD CONSTRAINT "budget_policies_company_scope_metric_unique_idx" UNIQUE NULLS NOT DISTINCT ("company_id","scope_type","scope_id","metric","window_kind","feature_scope","subscription_quota_lane");
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
ALTER TABLE "leads" ADD COLUMN IF NOT EXISTS "product_user_id" text;--> statement-breakpoint
|
|
2
|
+
UPDATE "leads" SET "product_user_id" = "platform_user_id" WHERE "platform_user_id" IS NOT NULL AND "product_user_id" IS NULL;--> statement-breakpoint
|
|
3
|
+
UPDATE "leads" SET "platform_user_id" = NULL;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
UPDATE "leads"
|
|
2
|
+
SET "platform_user_id" = "product_user_id",
|
|
3
|
+
"product_user_id" = NULL,
|
|
4
|
+
"status" = CASE WHEN "status" = 'signed_up' THEN 'drafted' ELSE "status" END,
|
|
5
|
+
"signed_up_at" = NULL
|
|
6
|
+
WHERE "primary_platform" = 'x'
|
|
7
|
+
AND "product_user_id" IS NOT NULL
|
|
8
|
+
AND "product_user_id" ~ '^[0-9]+$';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "agents" ADD COLUMN IF NOT EXISTS "image_url" text;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
ALTER TABLE "chat_sessions" ADD COLUMN IF NOT EXISTS "target_agent_id" uuid;--> statement-breakpoint
|
|
2
|
+
ALTER TABLE "chat_sessions" ADD CONSTRAINT "chat_sessions_target_agent_id_agents_id_fk" FOREIGN KEY ("target_agent_id") REFERENCES "public"."agents"("id") ON DELETE set null ON UPDATE no action;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
CREATE TABLE "document_folders" (
|
|
2
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
3
|
+
"company_id" uuid NOT NULL,
|
|
4
|
+
"name" text NOT NULL,
|
|
5
|
+
"parent_folder_id" uuid,
|
|
6
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
7
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
8
|
+
);
|
|
9
|
+
--> statement-breakpoint
|
|
10
|
+
ALTER TABLE "document_folders" ADD CONSTRAINT "document_folders_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE cascade ON UPDATE no action;
|
|
11
|
+
--> statement-breakpoint
|
|
12
|
+
ALTER TABLE "documents" ADD COLUMN "folder_id" uuid;
|
|
13
|
+
--> statement-breakpoint
|
|
14
|
+
ALTER TABLE "documents" ADD CONSTRAINT "documents_folder_id_document_folders_id_fk" FOREIGN KEY ("folder_id") REFERENCES "public"."document_folders"("id") ON DELETE set null ON UPDATE no action;
|
|
15
|
+
--> statement-breakpoint
|
|
16
|
+
CREATE INDEX "document_folders_company_name_idx" ON "document_folders" USING btree ("company_id","name");
|
|
17
|
+
--> statement-breakpoint
|
|
18
|
+
CREATE INDEX "document_folders_company_updated_idx" ON "document_folders" USING btree ("company_id","updated_at");
|
|
19
|
+
--> statement-breakpoint
|
|
20
|
+
CREATE INDEX "document_folders_company_parent_idx" ON "document_folders" USING btree ("company_id","parent_folder_id");
|
|
21
|
+
--> statement-breakpoint
|
|
22
|
+
CREATE INDEX "documents_company_folder_updated_idx" ON "documents" USING btree ("company_id","folder_id","updated_at");
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
ALTER TABLE "leads" ADD COLUMN "ever_replied" boolean DEFAULT false NOT NULL;--> statement-breakpoint
|
|
2
|
+
ALTER TABLE "leads" ADD COLUMN "ever_signed_up" boolean DEFAULT false NOT NULL;--> statement-breakpoint
|
|
3
|
+
UPDATE "leads" SET "ever_replied" = true WHERE "last_reply_at" IS NOT NULL;--> statement-breakpoint
|
|
4
|
+
UPDATE "leads" SET "ever_signed_up" = true WHERE "signed_up_at" IS NOT NULL OR "status" = 'signed_up';
|