@bettercms-ai/db 0.7.0 → 0.8.1
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/index.d.ts +1210 -827
- package/dist/index.js +241 -210
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22107,6 +22107,7 @@ __export(index_exports, {
|
|
|
22107
22107
|
projectsRelations: () => projectsRelations,
|
|
22108
22108
|
publishDeliveries: () => publishDeliveries,
|
|
22109
22109
|
publishItems: () => publishItems,
|
|
22110
|
+
publishValueOutcomes: () => publishValueOutcomes,
|
|
22110
22111
|
publishes: () => publishes,
|
|
22111
22112
|
qaReports: () => qaReports,
|
|
22112
22113
|
rebuildQueue: () => rebuildQueue,
|
|
@@ -23090,7 +23091,8 @@ var forms = pgTable7(
|
|
|
23090
23091
|
/**
|
|
23091
23092
|
* Not one of the customer's CMS forms (0365): never counted, wired or put in the conversion
|
|
23092
23093
|
* brief, but kept as a grey row with "Restore". `user` = the row action; `auth-heuristic` =
|
|
23093
|
-
* the derive lane judged it the site's own sign-in / register / reset form
|
|
23094
|
+
* the derive lane judged it the site's own sign-in / register / reset form; `commerce-action` =
|
|
23095
|
+
* the shop's own add-to-basket or checkout form. Before 0365 such a
|
|
23094
23096
|
* form was dropped at derive time, so a wrong guess had no row to restore.
|
|
23095
23097
|
*/
|
|
23096
23098
|
ignoredAt: timestamp8("ignored_at"),
|
|
@@ -23571,6 +23573,10 @@ var projects = pgTable10(
|
|
|
23571
23573
|
runtimeContent: varchar10("runtime_content", { length: 16 }),
|
|
23572
23574
|
// What the build's setup and the on-demand editor setup last did (0391). @see lib/hosting/setup-state.ts
|
|
23573
23575
|
setupState: jsonb8("setup_state").$type(),
|
|
23576
|
+
// In-place structure on a code-built site (0402): the release annotator stamps section bands
|
|
23577
|
+
// and the content apply moves, removes and inserts sections in the live HTML. Off for every
|
|
23578
|
+
// project that existed before 0402; on by default after. @see src/lib/hosting/sections-in-place.ts
|
|
23579
|
+
structureInPlace: boolean7("structure_in_place").notNull().default(true),
|
|
23574
23580
|
// The project's switch for custom dock inputs (0394): { enabled, disabled[] }. NULL = off.
|
|
23575
23581
|
// @see src/lib/projects/dock-inputs.ts
|
|
23576
23582
|
dockInputs: jsonb8("dock_inputs").$type(),
|
|
@@ -25510,7 +25516,7 @@ var deployTargets = pgTable52(
|
|
|
25510
25516
|
);
|
|
25511
25517
|
|
|
25512
25518
|
// src/schema/publishes.ts
|
|
25513
|
-
import { pgTable as pgTable53, text as text54, varchar as varchar37, timestamp as timestamp49, index as index47 } from "drizzle-orm/pg-core";
|
|
25519
|
+
import { pgTable as pgTable53, text as text54, varchar as varchar37, timestamp as timestamp49, index as index47, uniqueIndex as uniqueIndex21, jsonb as jsonb27 } from "drizzle-orm/pg-core";
|
|
25514
25520
|
var publishes = pgTable53(
|
|
25515
25521
|
"publishes",
|
|
25516
25522
|
{
|
|
@@ -25583,9 +25589,33 @@ var publishDeliveries = pgTable53(
|
|
|
25583
25589
|
index47("publish_deliveries_open_idx").on(t.projectId, t.host, t.status)
|
|
25584
25590
|
]
|
|
25585
25591
|
);
|
|
25592
|
+
var publishValueOutcomes = pgTable53(
|
|
25593
|
+
"publish_value_outcomes",
|
|
25594
|
+
{
|
|
25595
|
+
id: text54("id").primaryKey(),
|
|
25596
|
+
publishId: text54("publish_id").notNull(),
|
|
25597
|
+
workspaceId: text54("workspace_id").notNull(),
|
|
25598
|
+
projectId: text54("project_id").notNull(),
|
|
25599
|
+
route: text54("route").notNull(),
|
|
25600
|
+
address: text54("address").notNull(),
|
|
25601
|
+
kind: varchar37("kind", { length: 16 }).notNull(),
|
|
25602
|
+
/** live | held | refused | unverified */
|
|
25603
|
+
state: varchar37("state", { length: 16 }).notNull(),
|
|
25604
|
+
/** The machine code of a row that is not live; a DB CHECK requires it there. */
|
|
25605
|
+
reason: varchar37("reason", { length: 48 }),
|
|
25606
|
+
actionJson: jsonb27("action_json"),
|
|
25607
|
+
evidenceJson: jsonb27("evidence_json"),
|
|
25608
|
+
checkedAt: timestamp49("checked_at", { withTimezone: true }).notNull().defaultNow(),
|
|
25609
|
+
createdAt: timestamp49("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
25610
|
+
},
|
|
25611
|
+
(t) => [
|
|
25612
|
+
uniqueIndex21("publish_value_outcomes_value_idx").on(t.publishId, t.route, t.address),
|
|
25613
|
+
index47("publish_value_outcomes_route_idx").on(t.projectId, t.route)
|
|
25614
|
+
]
|
|
25615
|
+
);
|
|
25586
25616
|
|
|
25587
25617
|
// src/schema/hosting_connections.ts
|
|
25588
|
-
import { pgTable as pgTable54, text as text55, varchar as varchar38, timestamp as timestamp50, index as index48, uniqueIndex as
|
|
25618
|
+
import { pgTable as pgTable54, text as text55, varchar as varchar38, timestamp as timestamp50, index as index48, uniqueIndex as uniqueIndex22 } from "drizzle-orm/pg-core";
|
|
25589
25619
|
import { sql as sql11 } from "drizzle-orm";
|
|
25590
25620
|
var hostingConnections = pgTable54(
|
|
25591
25621
|
"hosting_connections",
|
|
@@ -25624,12 +25654,12 @@ var hostingConnections = pgTable54(
|
|
|
25624
25654
|
(t) => [
|
|
25625
25655
|
index48("hosting_connections_workspace_idx").on(t.workspaceId),
|
|
25626
25656
|
// Reconnecting the same account UPDATEs rather than accumulating a second live credential.
|
|
25627
|
-
|
|
25657
|
+
uniqueIndex22("hosting_connections_account_unique").on(t.workspaceId, t.provider, t.accountId).where(sql11`deleted_at IS NULL`)
|
|
25628
25658
|
]
|
|
25629
25659
|
);
|
|
25630
25660
|
|
|
25631
25661
|
// src/schema/external_deployments.ts
|
|
25632
|
-
import { pgTable as pgTable55, text as text56, varchar as varchar39, integer as integer23, timestamp as timestamp51, index as index49, uniqueIndex as
|
|
25662
|
+
import { pgTable as pgTable55, text as text56, varchar as varchar39, integer as integer23, timestamp as timestamp51, index as index49, uniqueIndex as uniqueIndex23 } from "drizzle-orm/pg-core";
|
|
25633
25663
|
import { sql as sql12 } from "drizzle-orm";
|
|
25634
25664
|
var externalDeployments = pgTable55(
|
|
25635
25665
|
"external_deployments",
|
|
@@ -25676,12 +25706,12 @@ var externalDeployments = pgTable55(
|
|
|
25676
25706
|
* Git-mode rows have sha NULL and are therefore NOT covered — NULLs never conflict — which is
|
|
25677
25707
|
* correct: a git deploy carries no artifact identity, so two publishes are two real builds.
|
|
25678
25708
|
*/
|
|
25679
|
-
|
|
25709
|
+
uniqueIndex23("external_deployments_inflight_unique").on(t.targetId, t.sha).where(sql12`state IN ('queued', 'deploying')`)
|
|
25680
25710
|
]
|
|
25681
25711
|
);
|
|
25682
25712
|
|
|
25683
25713
|
// src/schema/page_types.ts
|
|
25684
|
-
import { pgTable as pgTable56, text as text57, varchar as varchar40, jsonb as
|
|
25714
|
+
import { pgTable as pgTable56, text as text57, varchar as varchar40, jsonb as jsonb28, index as index50, uniqueIndex as uniqueIndex24 } from "drizzle-orm/pg-core";
|
|
25685
25715
|
var pageTypes = pgTable56(
|
|
25686
25716
|
"page_types",
|
|
25687
25717
|
{
|
|
@@ -25692,8 +25722,8 @@ var pageTypes = pgTable56(
|
|
|
25692
25722
|
slug: varchar40("slug", { length: 255 }).notNull(),
|
|
25693
25723
|
/** Same ContentModelField[] shape `pages.fields` holds — a type exists so several pages
|
|
25694
25724
|
* can SHARE one schema instead of each carrying a copy. */
|
|
25695
|
-
fields:
|
|
25696
|
-
routingJson:
|
|
25725
|
+
fields: jsonb28("fields").$type().notNull().default([]),
|
|
25726
|
+
routingJson: jsonb28("routing_json").$type(),
|
|
25697
25727
|
...branchColumns,
|
|
25698
25728
|
...auditColumns,
|
|
25699
25729
|
...softDeleteColumn
|
|
@@ -25701,12 +25731,12 @@ var pageTypes = pgTable56(
|
|
|
25701
25731
|
(t) => [
|
|
25702
25732
|
index50("page_types_project_idx").on(t.projectId),
|
|
25703
25733
|
index50("page_types_workspace_idx").on(t.workspaceId),
|
|
25704
|
-
|
|
25734
|
+
uniqueIndex24("page_types_project_slug_unique").on(t.projectId, t.branchId, t.slug)
|
|
25705
25735
|
]
|
|
25706
25736
|
);
|
|
25707
25737
|
|
|
25708
25738
|
// src/schema/build_triggers.ts
|
|
25709
|
-
import { pgTable as pgTable57, text as text58, varchar as varchar41, boolean as boolean26, timestamp as timestamp53, integer as integer24, jsonb as
|
|
25739
|
+
import { pgTable as pgTable57, text as text58, varchar as varchar41, boolean as boolean26, timestamp as timestamp53, integer as integer24, jsonb as jsonb29, index as index51, uniqueIndex as uniqueIndex25 } from "drizzle-orm/pg-core";
|
|
25710
25740
|
var BUILD_TRIGGER_KINDS = ["webhook", "content", "schedule"];
|
|
25711
25741
|
var buildTriggers = pgTable57(
|
|
25712
25742
|
"build_triggers",
|
|
@@ -25728,7 +25758,7 @@ var buildTriggers = pgTable57(
|
|
|
25728
25758
|
prevSecretEnc: text58("prev_secret_enc"),
|
|
25729
25759
|
prevSecretExpiresAt: timestamp53("prev_secret_expires_at"),
|
|
25730
25760
|
/** `[]` = every publish. Model SLUGS, not ids — ids break across a model rebuild. */
|
|
25731
|
-
contentScopes:
|
|
25761
|
+
contentScopes: jsonb29("content_scopes").$type().notNull().default([]),
|
|
25732
25762
|
schedule: varchar41("schedule", { length: 120 }),
|
|
25733
25763
|
/** IANA zone. "Rebuild at 9am" means 9am where the customer is. */
|
|
25734
25764
|
timezone: varchar41("timezone", { length: 64 }).notNull().default("UTC"),
|
|
@@ -25741,7 +25771,7 @@ var buildTriggers = pgTable57(
|
|
|
25741
25771
|
(t) => [
|
|
25742
25772
|
index51("build_triggers_project_idx").on(t.projectId),
|
|
25743
25773
|
index51("build_triggers_workspace_idx").on(t.workspaceId),
|
|
25744
|
-
|
|
25774
|
+
uniqueIndex25("build_triggers_project_name_unique").on(t.projectId, t.name)
|
|
25745
25775
|
]
|
|
25746
25776
|
);
|
|
25747
25777
|
var buildTriggerRuns = pgTable57(
|
|
@@ -25804,7 +25834,7 @@ var generatedTypes = pgTable59("generated_types", {
|
|
|
25804
25834
|
});
|
|
25805
25835
|
|
|
25806
25836
|
// src/schema/agent_keys.ts
|
|
25807
|
-
import { pgTable as pgTable60, text as text61, uniqueIndex as
|
|
25837
|
+
import { pgTable as pgTable60, text as text61, uniqueIndex as uniqueIndex26 } from "drizzle-orm/pg-core";
|
|
25808
25838
|
var agentKeys = pgTable60(
|
|
25809
25839
|
"agent_keys",
|
|
25810
25840
|
{
|
|
@@ -25816,11 +25846,11 @@ var agentKeys = pgTable60(
|
|
|
25816
25846
|
// AES-256-GCM encrypted
|
|
25817
25847
|
...auditColumns
|
|
25818
25848
|
},
|
|
25819
|
-
(t) => [
|
|
25849
|
+
(t) => [uniqueIndex26("agent_keys_workspace_unique").on(t.workspaceId)]
|
|
25820
25850
|
);
|
|
25821
25851
|
|
|
25822
25852
|
// src/schema/ai_provider_keys.ts
|
|
25823
|
-
import { pgTable as pgTable61, text as text62, varchar as varchar44, uniqueIndex as
|
|
25853
|
+
import { pgTable as pgTable61, text as text62, varchar as varchar44, uniqueIndex as uniqueIndex27 } from "drizzle-orm/pg-core";
|
|
25824
25854
|
var aiProviderKeys = pgTable61(
|
|
25825
25855
|
"ai_provider_keys",
|
|
25826
25856
|
{
|
|
@@ -25834,11 +25864,11 @@ var aiProviderKeys = pgTable61(
|
|
|
25834
25864
|
keyHint: varchar44("key_hint", { length: 8 }).notNull(),
|
|
25835
25865
|
...auditColumns
|
|
25836
25866
|
},
|
|
25837
|
-
(t) => [
|
|
25867
|
+
(t) => [uniqueIndex27("ai_provider_keys_workspace_provider_key").on(t.workspaceId, t.provider)]
|
|
25838
25868
|
);
|
|
25839
25869
|
|
|
25840
25870
|
// src/schema/agent_sessions.ts
|
|
25841
|
-
import { pgTable as pgTable62, text as text63, varchar as varchar45, timestamp as timestamp56, doublePrecision, jsonb as
|
|
25871
|
+
import { pgTable as pgTable62, text as text63, varchar as varchar45, timestamp as timestamp56, doublePrecision, jsonb as jsonb30, index as index52 } from "drizzle-orm/pg-core";
|
|
25842
25872
|
var agentSessions = pgTable62(
|
|
25843
25873
|
"agent_sessions",
|
|
25844
25874
|
{
|
|
@@ -25879,7 +25909,7 @@ var agentMessages = pgTable62(
|
|
|
25879
25909
|
sessionId: text63("session_id").notNull(),
|
|
25880
25910
|
role: varchar45("role", { length: 16 }).notNull(),
|
|
25881
25911
|
// user | assistant | tool
|
|
25882
|
-
content:
|
|
25912
|
+
content: jsonb30("content").notNull(),
|
|
25883
25913
|
// { text? , toolName?, toolInput?, toolResult? ... }
|
|
25884
25914
|
createdAt: timestamp56("created_at").notNull().defaultNow()
|
|
25885
25915
|
},
|
|
@@ -25887,7 +25917,7 @@ var agentMessages = pgTable62(
|
|
|
25887
25917
|
);
|
|
25888
25918
|
|
|
25889
25919
|
// src/schema/agent_instructions.ts
|
|
25890
|
-
import { pgTable as pgTable63, text as text64, varchar as varchar46, boolean as boolean27, jsonb as
|
|
25920
|
+
import { pgTable as pgTable63, text as text64, varchar as varchar46, boolean as boolean27, jsonb as jsonb31, timestamp as timestamp57, index as index53, check as check2 } from "drizzle-orm/pg-core";
|
|
25891
25921
|
import { sql as sql13 } from "drizzle-orm";
|
|
25892
25922
|
var INSTRUCTION_KINDS = ["skill", "rule"];
|
|
25893
25923
|
var INSTRUCTION_SOURCES = ["template", "manual", "import"];
|
|
@@ -25907,7 +25937,7 @@ var agentInstructions = pgTable63(
|
|
|
25907
25937
|
/** Master switch. Off = ignored everywhere, regardless of `disabledFor`. */
|
|
25908
25938
|
enabled: boolean27("enabled").notNull().default(true),
|
|
25909
25939
|
/** Project ids that opted OUT. Workspace-wide by default, scoped by exception. */
|
|
25910
|
-
disabledFor:
|
|
25940
|
+
disabledFor: jsonb31("disabled_for").$type().notNull().default([]),
|
|
25911
25941
|
source: varchar46("source", { length: 16 }).$type().notNull().default("manual"),
|
|
25912
25942
|
templateId: varchar46("template_id", { length: 64 }),
|
|
25913
25943
|
// set when source === "template"
|
|
@@ -25935,11 +25965,11 @@ import {
|
|
|
25935
25965
|
check as check3,
|
|
25936
25966
|
index as index54,
|
|
25937
25967
|
integer as integer26,
|
|
25938
|
-
jsonb as
|
|
25968
|
+
jsonb as jsonb32,
|
|
25939
25969
|
pgTable as pgTable64,
|
|
25940
25970
|
text as text65,
|
|
25941
25971
|
timestamp as timestamp58,
|
|
25942
|
-
uniqueIndex as
|
|
25972
|
+
uniqueIndex as uniqueIndex28,
|
|
25943
25973
|
varchar as varchar47
|
|
25944
25974
|
} from "drizzle-orm/pg-core";
|
|
25945
25975
|
import { sql as sql14 } from "drizzle-orm";
|
|
@@ -25969,7 +25999,7 @@ var customAgents = pgTable64(
|
|
|
25969
25999
|
archivedAt: timestamp58("archived_at", { withTimezone: true })
|
|
25970
26000
|
},
|
|
25971
26001
|
(table) => [
|
|
25972
|
-
|
|
26002
|
+
uniqueIndex28("custom_agents_workspace_slug_unique").on(table.workspaceId, table.slug),
|
|
25973
26003
|
index54("custom_agents_workspace_status_idx").on(table.workspaceId, table.status, table.updatedAt),
|
|
25974
26004
|
index54("custom_agents_project_status_idx").on(table.projectId, table.status, table.updatedAt),
|
|
25975
26005
|
check3("custom_agents_status_check", sql14`${table.status} IN ('active', 'archived')`),
|
|
@@ -25986,14 +26016,14 @@ var customAgentRevisions = pgTable64(
|
|
|
25986
26016
|
version: integer26("version").notNull(),
|
|
25987
26017
|
instructions: text65("instructions").notNull(),
|
|
25988
26018
|
speed: varchar47("speed", { length: 16 }).$type().notNull().default("balanced"),
|
|
25989
|
-
capabilities:
|
|
26019
|
+
capabilities: jsonb32("capabilities").$type().notNull().default([]),
|
|
25990
26020
|
reviewPolicy: varchar47("review_policy", { length: 24 }).notNull().default("draft_only"),
|
|
25991
26021
|
configDigest: varchar47("config_digest", { length: 64 }).notNull(),
|
|
25992
26022
|
createdBy: text65("created_by"),
|
|
25993
26023
|
createdAt: timestamp58("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
25994
26024
|
},
|
|
25995
26025
|
(table) => [
|
|
25996
|
-
|
|
26026
|
+
uniqueIndex28("custom_agent_revisions_agent_version_unique").on(table.agentId, table.version),
|
|
25997
26027
|
index54("custom_agent_revisions_workspace_agent_idx").on(table.workspaceId, table.agentId),
|
|
25998
26028
|
check3("custom_agent_revisions_version_check", sql14`${table.version} > 0`),
|
|
25999
26029
|
check3("custom_agent_revisions_speed_check", sql14`${table.speed} IN ('lite', 'balanced', 'max')`),
|
|
@@ -26032,7 +26062,7 @@ var customAgentRuns = pgTable64(
|
|
|
26032
26062
|
updatedAt: timestamp58("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
26033
26063
|
},
|
|
26034
26064
|
(table) => [
|
|
26035
|
-
|
|
26065
|
+
uniqueIndex28("custom_agent_runs_agent_idempotency_unique").on(table.agentId, table.idempotencyKey),
|
|
26036
26066
|
index54("custom_agent_runs_agent_created_idx").on(table.agentId, table.createdAt),
|
|
26037
26067
|
index54("custom_agent_runs_workspace_status_idx").on(table.workspaceId, table.status, table.createdAt),
|
|
26038
26068
|
index54("custom_agent_runs_project_status_idx").on(table.projectId, table.status, table.createdAt),
|
|
@@ -26047,7 +26077,7 @@ var customAgentRuns = pgTable64(
|
|
|
26047
26077
|
);
|
|
26048
26078
|
|
|
26049
26079
|
// src/schema/ai_generation_jobs.ts
|
|
26050
|
-
import { pgTable as pgTable65, text as text66, varchar as varchar48, integer as integer27, jsonb as
|
|
26080
|
+
import { pgTable as pgTable65, text as text66, varchar as varchar48, integer as integer27, jsonb as jsonb33, timestamp as timestamp59, index as index55 } from "drizzle-orm/pg-core";
|
|
26051
26081
|
var aiGenerationJobs = pgTable65(
|
|
26052
26082
|
"ai_generation_jobs",
|
|
26053
26083
|
{
|
|
@@ -26063,9 +26093,9 @@ var aiGenerationJobs = pgTable65(
|
|
|
26063
26093
|
// Durable because the drain runs after the request connection (and its GUCs) is gone.
|
|
26064
26094
|
// AI-produced content is always an agent write, even when a human queued the job.
|
|
26065
26095
|
writeOrigin: text66("write_origin").$type().notNull().default("agent:tab"),
|
|
26066
|
-
mapping:
|
|
26096
|
+
mapping: jsonb33("mapping").notNull(),
|
|
26067
26097
|
// GenerateMapping (generate) | { contentModelId } (seo)
|
|
26068
|
-
rows:
|
|
26098
|
+
rows: jsonb33("rows").notNull(),
|
|
26069
26099
|
/**
|
|
26070
26100
|
* needs_approval | queued | running | done | failed
|
|
26071
26101
|
*
|
|
@@ -26084,7 +26114,7 @@ var aiGenerationJobs = pgTable65(
|
|
|
26084
26114
|
* scope/estimate that is approved is the scope/estimate that runs. Null on jobs that never
|
|
26085
26115
|
* needed approval. Mirrors the migration_jobs.plan precedent.
|
|
26086
26116
|
*/
|
|
26087
|
-
plan:
|
|
26117
|
+
plan: jsonb33("plan"),
|
|
26088
26118
|
total: integer27("total").notNull().default(0),
|
|
26089
26119
|
processed: integer27("processed").notNull().default(0),
|
|
26090
26120
|
cursor: integer27("cursor").notNull().default(0),
|
|
@@ -26105,7 +26135,7 @@ var aiGenerationJobs = pgTable65(
|
|
|
26105
26135
|
* Per-row outcomes for rows that did NOT produce an entry, so `processed = created + failed +
|
|
26106
26136
|
* skipped` is explainable. `[{ row, status, reason, detail? }]` — see lib/generate/reasons.ts.
|
|
26107
26137
|
*/
|
|
26108
|
-
rowResults:
|
|
26138
|
+
rowResults: jsonb33("row_results").notNull().default([]),
|
|
26109
26139
|
/** Phase 1 ABM campaign this job belongs to. Null on every SEO/rename/migrate job. */
|
|
26110
26140
|
campaignId: text66("campaign_id"),
|
|
26111
26141
|
/**
|
|
@@ -26133,7 +26163,7 @@ var previewTokenRevocations = pgTable66("preview_token_revocations", {
|
|
|
26133
26163
|
});
|
|
26134
26164
|
|
|
26135
26165
|
// src/schema/abm_campaigns.ts
|
|
26136
|
-
import { index as index56, integer as integer28, jsonb as
|
|
26166
|
+
import { index as index56, integer as integer28, jsonb as jsonb34, pgTable as pgTable67, text as text68, timestamp as timestamp61, varchar as varchar49 } from "drizzle-orm/pg-core";
|
|
26137
26167
|
var abmCampaigns = pgTable67(
|
|
26138
26168
|
"abm_campaigns",
|
|
26139
26169
|
{
|
|
@@ -26148,7 +26178,7 @@ var abmCampaigns = pgTable67(
|
|
|
26148
26178
|
kind: varchar49("kind", { length: 16 }).notNull().default("abm"),
|
|
26149
26179
|
/** draft | generating | review | scheduled | live | expired | failed */
|
|
26150
26180
|
status: varchar49("status", { length: 16 }).notNull().default("draft"),
|
|
26151
|
-
options:
|
|
26181
|
+
options: jsonb34("options").$type().notNull().default({}),
|
|
26152
26182
|
scheduledAt: timestamp61("scheduled_at", { withTimezone: true }),
|
|
26153
26183
|
unpublishAt: timestamp61("unpublish_at", { withTimezone: true }),
|
|
26154
26184
|
creditsSpent: integer28("credits_spent").notNull().default(0),
|
|
@@ -26184,7 +26214,7 @@ var abmShareTokens = pgTable68(
|
|
|
26184
26214
|
);
|
|
26185
26215
|
|
|
26186
26216
|
// src/schema/mcp_tasks.ts
|
|
26187
|
-
import { check as check4, index as index58, integer as integer30, jsonb as
|
|
26217
|
+
import { check as check4, index as index58, integer as integer30, jsonb as jsonb35, pgTable as pgTable69, text as text70, timestamp as timestamp63, uniqueIndex as uniqueIndex29, varchar as varchar51 } from "drizzle-orm/pg-core";
|
|
26188
26218
|
import { sql as sql15 } from "drizzle-orm";
|
|
26189
26219
|
var MCP_TASK_STATUSES = [
|
|
26190
26220
|
"working",
|
|
@@ -26205,8 +26235,8 @@ var mcpTasks = pgTable69(
|
|
|
26205
26235
|
aiJobId: text70("ai_job_id"),
|
|
26206
26236
|
status: varchar51("status", { length: 24 }).$type().notNull().default("working"),
|
|
26207
26237
|
statusMessage: text70("status_message"),
|
|
26208
|
-
inputState:
|
|
26209
|
-
finalResult:
|
|
26238
|
+
inputState: jsonb35("input_state").$type().notNull().default({}),
|
|
26239
|
+
finalResult: jsonb35("final_result").$type(),
|
|
26210
26240
|
ttlMs: integer30("ttl_ms"),
|
|
26211
26241
|
pollIntervalMs: integer30("poll_interval_ms").notNull().default(2e3),
|
|
26212
26242
|
cancelRequestedAt: timestamp63("cancel_requested_at"),
|
|
@@ -26215,7 +26245,7 @@ var mcpTasks = pgTable69(
|
|
|
26215
26245
|
updatedAt: timestamp63("updated_at").notNull().defaultNow()
|
|
26216
26246
|
},
|
|
26217
26247
|
(table) => [
|
|
26218
|
-
|
|
26248
|
+
uniqueIndex29("mcp_tasks_ai_job_uidx").on(table.aiJobId).where(sql15`${table.aiJobId} IS NOT NULL`),
|
|
26219
26249
|
index58("mcp_tasks_principal_idx").on(
|
|
26220
26250
|
table.workspaceId,
|
|
26221
26251
|
table.projectId,
|
|
@@ -26246,7 +26276,7 @@ var mcpTasks = pgTable69(
|
|
|
26246
26276
|
);
|
|
26247
26277
|
|
|
26248
26278
|
// src/schema/seo_reports.ts
|
|
26249
|
-
import { pgTable as pgTable70, text as text71, date, jsonb as
|
|
26279
|
+
import { pgTable as pgTable70, text as text71, date, jsonb as jsonb36, timestamp as timestamp64, uniqueIndex as uniqueIndex30, index as index59 } from "drizzle-orm/pg-core";
|
|
26250
26280
|
var seoReports = pgTable70(
|
|
26251
26281
|
"seo_reports",
|
|
26252
26282
|
{
|
|
@@ -26256,19 +26286,19 @@ var seoReports = pgTable70(
|
|
|
26256
26286
|
projectId: text71("project_id").notNull(),
|
|
26257
26287
|
periodStart: date("period_start").notNull(),
|
|
26258
26288
|
periodEnd: date("period_end").notNull(),
|
|
26259
|
-
metricsJson:
|
|
26289
|
+
metricsJson: jsonb36("metrics_json").$type().notNull(),
|
|
26260
26290
|
summary: text71("summary").notNull(),
|
|
26261
26291
|
createdAt: timestamp64("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
26262
26292
|
},
|
|
26263
26293
|
(t) => [
|
|
26264
26294
|
// Idempotency guard: one report per period (matches the per-minute cron).
|
|
26265
|
-
|
|
26295
|
+
uniqueIndex30("seo_reports_project_period_idx").on(t.projectId, t.periodStart, t.periodEnd),
|
|
26266
26296
|
index59("seo_reports_project_created_idx").on(t.projectId, t.createdAt)
|
|
26267
26297
|
]
|
|
26268
26298
|
);
|
|
26269
26299
|
|
|
26270
26300
|
// src/schema/qa_reports.ts
|
|
26271
|
-
import { pgTable as pgTable71, text as text72, integer as integer31, jsonb as
|
|
26301
|
+
import { pgTable as pgTable71, text as text72, integer as integer31, jsonb as jsonb37, timestamp as timestamp65, index as index60 } from "drizzle-orm/pg-core";
|
|
26272
26302
|
var qaReports = pgTable71(
|
|
26273
26303
|
"qa_reports",
|
|
26274
26304
|
{
|
|
@@ -26276,7 +26306,7 @@ var qaReports = pgTable71(
|
|
|
26276
26306
|
// nanoid
|
|
26277
26307
|
workspaceId: text72("workspace_id").notNull(),
|
|
26278
26308
|
projectId: text72("project_id").notNull(),
|
|
26279
|
-
findingsJson:
|
|
26309
|
+
findingsJson: jsonb37("findings_json").$type().notNull(),
|
|
26280
26310
|
summary: text72("summary").notNull(),
|
|
26281
26311
|
criticalCount: integer31("critical_count").notNull().default(0),
|
|
26282
26312
|
createdAt: timestamp65("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
@@ -26285,7 +26315,7 @@ var qaReports = pgTable71(
|
|
|
26285
26315
|
);
|
|
26286
26316
|
|
|
26287
26317
|
// src/schema/webflow_integrations.ts
|
|
26288
|
-
import { pgTable as pgTable72, text as text73, varchar as varchar52, jsonb as
|
|
26318
|
+
import { pgTable as pgTable72, text as text73, varchar as varchar52, jsonb as jsonb38, timestamp as timestamp66, index as index61 } from "drizzle-orm/pg-core";
|
|
26289
26319
|
var webflowIntegrations = pgTable72(
|
|
26290
26320
|
"webflow_integrations",
|
|
26291
26321
|
{
|
|
@@ -26299,7 +26329,7 @@ var webflowIntegrations = pgTable72(
|
|
|
26299
26329
|
// display only; may be absent
|
|
26300
26330
|
accessToken: text73("access_token").notNull(),
|
|
26301
26331
|
// encrypted at rest
|
|
26302
|
-
scopes:
|
|
26332
|
+
scopes: jsonb38("scopes").$type().notNull().default([]),
|
|
26303
26333
|
connectedBy: text73("connected_by"),
|
|
26304
26334
|
// FK → users.id
|
|
26305
26335
|
createdAt: timestamp66("created_at").notNull().defaultNow(),
|
|
@@ -26309,7 +26339,7 @@ var webflowIntegrations = pgTable72(
|
|
|
26309
26339
|
);
|
|
26310
26340
|
|
|
26311
26341
|
// src/schema/migration_jobs.ts
|
|
26312
|
-
import { pgTable as pgTable73, text as text74, varchar as varchar53, integer as integer32, jsonb as
|
|
26342
|
+
import { pgTable as pgTable73, text as text74, varchar as varchar53, integer as integer32, jsonb as jsonb39, timestamp as timestamp67, index as index62 } from "drizzle-orm/pg-core";
|
|
26313
26343
|
var migrationJobs = pgTable73(
|
|
26314
26344
|
"migration_jobs",
|
|
26315
26345
|
{
|
|
@@ -26322,11 +26352,11 @@ var migrationJobs = pgTable73(
|
|
|
26322
26352
|
// webflow | framer
|
|
26323
26353
|
framework: varchar53("framework", { length: 16 }).notNull().default("astro"),
|
|
26324
26354
|
// astro | next
|
|
26325
|
-
plan:
|
|
26355
|
+
plan: jsonb39("plan").notNull(),
|
|
26326
26356
|
// MigrationPlan (user-confirmed mapping)
|
|
26327
|
-
graph:
|
|
26357
|
+
graph: jsonb39("graph"),
|
|
26328
26358
|
// reserved for a future per-phase checkpoint — NOT written today
|
|
26329
|
-
report:
|
|
26359
|
+
report: jsonb39("report"),
|
|
26330
26360
|
// MigrationReport, written once when the job reaches done | failed
|
|
26331
26361
|
// queued | crawling | binding | seeding | media | repo | done | failed
|
|
26332
26362
|
status: varchar53("status", { length: 16 }).notNull().default("queued"),
|
|
@@ -26346,7 +26376,7 @@ var migrationJobs = pgTable73(
|
|
|
26346
26376
|
);
|
|
26347
26377
|
|
|
26348
26378
|
// src/schema/ai_reports.ts
|
|
26349
|
-
import { pgTable as pgTable74, text as text75, varchar as varchar54, jsonb as
|
|
26379
|
+
import { pgTable as pgTable74, text as text75, varchar as varchar54, jsonb as jsonb40, timestamp as timestamp68, index as index63 } from "drizzle-orm/pg-core";
|
|
26350
26380
|
var aiReports = pgTable74(
|
|
26351
26381
|
"ai_reports",
|
|
26352
26382
|
{
|
|
@@ -26355,7 +26385,7 @@ var aiReports = pgTable74(
|
|
|
26355
26385
|
workspaceId: text75("workspace_id").notNull(),
|
|
26356
26386
|
projectId: text75("project_id").notNull(),
|
|
26357
26387
|
kind: varchar54("kind", { length: 16 }).$type().notNull(),
|
|
26358
|
-
findingsJson:
|
|
26388
|
+
findingsJson: jsonb40("findings_json").$type().notNull(),
|
|
26359
26389
|
summary: text75("summary").notNull(),
|
|
26360
26390
|
createdAt: timestamp68("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
26361
26391
|
},
|
|
@@ -26373,7 +26403,7 @@ import {
|
|
|
26373
26403
|
bigint as bigint3,
|
|
26374
26404
|
smallint,
|
|
26375
26405
|
index as index64,
|
|
26376
|
-
uniqueIndex as
|
|
26406
|
+
uniqueIndex as uniqueIndex31,
|
|
26377
26407
|
primaryKey as primaryKey4
|
|
26378
26408
|
} from "drizzle-orm/pg-core";
|
|
26379
26409
|
import { sql as sql16 } from "drizzle-orm";
|
|
@@ -26411,7 +26441,7 @@ var analyticsEventsRaw = pgTable75(
|
|
|
26411
26441
|
index64("analytics_events_raw_project_ts_idx").on(t.projectId, t.ts),
|
|
26412
26442
|
index64("analytics_events_raw_ts_idx").on(t.ts),
|
|
26413
26443
|
// Partial, so the nginx path (event_id NULL) is unconstrained and unchanged.
|
|
26414
|
-
|
|
26444
|
+
uniqueIndex31("analytics_events_raw_event_id_uidx").on(t.eventId).where(sql16`${t.eventId} IS NOT NULL`)
|
|
26415
26445
|
]
|
|
26416
26446
|
);
|
|
26417
26447
|
var analyticsDailyTotals = pgTable75(
|
|
@@ -26488,7 +26518,7 @@ var analyticsCursor = pgTable75("analytics_cursor", {
|
|
|
26488
26518
|
});
|
|
26489
26519
|
|
|
26490
26520
|
// src/schema/site_files.ts
|
|
26491
|
-
import { pgTable as pgTable76, text as text77, varchar as varchar56, integer as integer34, timestamp as timestamp70, uniqueIndex as
|
|
26521
|
+
import { pgTable as pgTable76, text as text77, varchar as varchar56, integer as integer34, timestamp as timestamp70, uniqueIndex as uniqueIndex32 } from "drizzle-orm/pg-core";
|
|
26492
26522
|
var SITE_FILE_KINDS = ["llms.txt", "llms-full.txt"];
|
|
26493
26523
|
var siteFiles = pgTable76(
|
|
26494
26524
|
"site_files",
|
|
@@ -26506,11 +26536,11 @@ var siteFiles = pgTable76(
|
|
|
26506
26536
|
createdAt: timestamp70("created_at").notNull().defaultNow(),
|
|
26507
26537
|
updatedAt: timestamp70("updated_at").notNull().defaultNow()
|
|
26508
26538
|
},
|
|
26509
|
-
(t) => [
|
|
26539
|
+
(t) => [uniqueIndex32("site_files_project_kind_idx").on(t.projectId, t.kind)]
|
|
26510
26540
|
);
|
|
26511
26541
|
|
|
26512
26542
|
// src/schema/indexnow_submissions.ts
|
|
26513
|
-
import { pgTable as pgTable77, text as text78, varchar as varchar57, integer as integer35, jsonb as
|
|
26543
|
+
import { pgTable as pgTable77, text as text78, varchar as varchar57, integer as integer35, jsonb as jsonb41, timestamp as timestamp71, index as index65 } from "drizzle-orm/pg-core";
|
|
26514
26544
|
var INDEXNOW_KINDS = ["auto", "manual", "retry"];
|
|
26515
26545
|
var INDEXNOW_STATUSES = ["ok", "failed"];
|
|
26516
26546
|
var indexnowSubmissions = pgTable77(
|
|
@@ -26523,7 +26553,7 @@ var indexnowSubmissions = pgTable77(
|
|
|
26523
26553
|
// FK → projects.id ON DELETE CASCADE (migration 0234)
|
|
26524
26554
|
/** The host as submitted, kept verbatim so a 422 stays explainable after a domain move. */
|
|
26525
26555
|
host: text78("host").notNull(),
|
|
26526
|
-
urls:
|
|
26556
|
+
urls: jsonb41("urls").$type().notNull().default([]),
|
|
26527
26557
|
urlCount: integer35("url_count").notNull().default(0),
|
|
26528
26558
|
status: varchar57("status", { length: 8 }).$type().notNull(),
|
|
26529
26559
|
/** NULL only when the request never got a response at all (DNS/timeout after 3 attempts). */
|
|
@@ -26536,7 +26566,7 @@ var indexnowSubmissions = pgTable77(
|
|
|
26536
26566
|
);
|
|
26537
26567
|
|
|
26538
26568
|
// src/schema/brand_kit_versions.ts
|
|
26539
|
-
import { pgTable as pgTable78, text as text79, integer as integer36, jsonb as
|
|
26569
|
+
import { pgTable as pgTable78, text as text79, integer as integer36, jsonb as jsonb42, timestamp as timestamp72, primaryKey as primaryKey5, index as index66 } from "drizzle-orm/pg-core";
|
|
26540
26570
|
var brandKitVersions = pgTable78(
|
|
26541
26571
|
"brand_kit_versions",
|
|
26542
26572
|
{
|
|
@@ -26547,7 +26577,7 @@ var brandKitVersions = pgTable78(
|
|
|
26547
26577
|
projectId: text79("project_id").notNull(),
|
|
26548
26578
|
// FK → projects.id ON DELETE CASCADE (0239)
|
|
26549
26579
|
version: integer36("version").notNull(),
|
|
26550
|
-
snapshot:
|
|
26580
|
+
snapshot: jsonb42("snapshot").$type().notNull(),
|
|
26551
26581
|
createdBy: text79("created_by"),
|
|
26552
26582
|
// FK → users(id), nullable: a system write has no author
|
|
26553
26583
|
createdAt: timestamp72("created_at").notNull().defaultNow()
|
|
@@ -26590,7 +26620,7 @@ var webhookDeliveries = pgTable79(
|
|
|
26590
26620
|
);
|
|
26591
26621
|
|
|
26592
26622
|
// src/schema/markdown_files.ts
|
|
26593
|
-
import { pgTable as pgTable80, text as text81, varchar as varchar59, timestamp as timestamp74, uniqueIndex as
|
|
26623
|
+
import { pgTable as pgTable80, text as text81, varchar as varchar59, timestamp as timestamp74, uniqueIndex as uniqueIndex33 } from "drizzle-orm/pg-core";
|
|
26594
26624
|
var MARKDOWN_FILE_STATUSES = ["draft", "published"];
|
|
26595
26625
|
var markdownFiles = pgTable80(
|
|
26596
26626
|
"markdown_files",
|
|
@@ -26609,7 +26639,7 @@ var markdownFiles = pgTable80(
|
|
|
26609
26639
|
createdAt: timestamp74("created_at").notNull().defaultNow(),
|
|
26610
26640
|
updatedAt: timestamp74("updated_at").notNull().defaultNow()
|
|
26611
26641
|
},
|
|
26612
|
-
(t) => [
|
|
26642
|
+
(t) => [uniqueIndex33("markdown_files_project_path_idx").on(t.projectId, t.path)]
|
|
26613
26643
|
);
|
|
26614
26644
|
var DEFAULT_AEO_CONFIG = {
|
|
26615
26645
|
llmsTxtEnabled: true,
|
|
@@ -26623,11 +26653,11 @@ import {
|
|
|
26623
26653
|
text as text84,
|
|
26624
26654
|
varchar as varchar62,
|
|
26625
26655
|
timestamp as timestamp76,
|
|
26626
|
-
jsonb as
|
|
26656
|
+
jsonb as jsonb44,
|
|
26627
26657
|
integer as integer39,
|
|
26628
26658
|
foreignKey as foreignKey4,
|
|
26629
26659
|
index as index70,
|
|
26630
|
-
uniqueIndex as
|
|
26660
|
+
uniqueIndex as uniqueIndex36
|
|
26631
26661
|
} from "drizzle-orm/pg-core";
|
|
26632
26662
|
import { relations as relations14 } from "drizzle-orm/relations";
|
|
26633
26663
|
import { sql as sql19 } from "drizzle-orm";
|
|
@@ -26637,11 +26667,11 @@ import {
|
|
|
26637
26667
|
foreignKey as foreignKey2,
|
|
26638
26668
|
index as index68,
|
|
26639
26669
|
integer as integer38,
|
|
26640
|
-
jsonb as
|
|
26670
|
+
jsonb as jsonb43,
|
|
26641
26671
|
pgTable as pgTable81,
|
|
26642
26672
|
text as text82,
|
|
26643
26673
|
timestamp as timestamp75,
|
|
26644
|
-
uniqueIndex as
|
|
26674
|
+
uniqueIndex as uniqueIndex34,
|
|
26645
26675
|
varchar as varchar60
|
|
26646
26676
|
} from "drizzle-orm/pg-core";
|
|
26647
26677
|
import { sql as sql17 } from "drizzle-orm";
|
|
@@ -26653,8 +26683,8 @@ var componentVariantGroups = pgTable81(
|
|
|
26653
26683
|
projectId: text82("project_id"),
|
|
26654
26684
|
name: varchar60("name", { length: 255 }).notNull(),
|
|
26655
26685
|
slug: varchar60("slug", { length: 255 }).notNull(),
|
|
26656
|
-
canonicalInputs:
|
|
26657
|
-
publishedCanonicalInputs:
|
|
26686
|
+
canonicalInputs: jsonb43("canonical_inputs").$type().notNull().default([]),
|
|
26687
|
+
publishedCanonicalInputs: jsonb43("published_canonical_inputs").$type(),
|
|
26658
26688
|
status: varchar60("status", { length: 20 }).notNull().default("draft"),
|
|
26659
26689
|
publishedAt: timestamp75("published_at"),
|
|
26660
26690
|
optimisticVersion: integer38("optimistic_version").notNull().default(0),
|
|
@@ -26670,7 +26700,7 @@ var componentVariantGroups = pgTable81(
|
|
|
26670
26700
|
}).onDelete("cascade"),
|
|
26671
26701
|
index68("component_variant_groups_workspace_idx").on(table.workspaceId),
|
|
26672
26702
|
index68("component_variant_groups_project_idx").on(table.projectId),
|
|
26673
|
-
|
|
26703
|
+
uniqueIndex34("component_variant_groups_scope_slug_unique").on(table.workspaceId, table.projectId, table.slug).where(sql17`${table.deletedAt} IS NULL`)
|
|
26674
26704
|
]
|
|
26675
26705
|
);
|
|
26676
26706
|
|
|
@@ -26680,7 +26710,7 @@ import {
|
|
|
26680
26710
|
index as index69,
|
|
26681
26711
|
pgTable as pgTable82,
|
|
26682
26712
|
text as text83,
|
|
26683
|
-
uniqueIndex as
|
|
26713
|
+
uniqueIndex as uniqueIndex35,
|
|
26684
26714
|
varchar as varchar61
|
|
26685
26715
|
} from "drizzle-orm/pg-core";
|
|
26686
26716
|
import { sql as sql18 } from "drizzle-orm";
|
|
@@ -26704,7 +26734,7 @@ var componentGroups = pgTable82(
|
|
|
26704
26734
|
}).onDelete("cascade"),
|
|
26705
26735
|
index69("component_groups_workspace_idx").on(table.workspaceId),
|
|
26706
26736
|
index69("component_groups_project_idx").on(table.projectId),
|
|
26707
|
-
|
|
26737
|
+
uniqueIndex35("component_groups_project_slug_unique").on(table.projectId, table.slug).where(sql18`${table.deletedAt} IS NULL`)
|
|
26708
26738
|
]
|
|
26709
26739
|
);
|
|
26710
26740
|
|
|
@@ -26753,15 +26783,15 @@ var components = pgTable83(
|
|
|
26753
26783
|
publishedVariantGroupId: text84("published_variant_group_id").references(() => componentVariantGroups.id, {
|
|
26754
26784
|
onDelete: "restrict"
|
|
26755
26785
|
}),
|
|
26756
|
-
variantInputMappings:
|
|
26786
|
+
variantInputMappings: jsonb44("variant_input_mappings").$type().notNull().default([]),
|
|
26757
26787
|
// The live canonical-input mapping snapshot. Draft mapping edits must never alter
|
|
26758
26788
|
// already-published Layout output before the Component is explicitly re-published.
|
|
26759
|
-
publishedVariantInputMappings:
|
|
26789
|
+
publishedVariantInputMappings: jsonb44("published_variant_input_mappings").$type(),
|
|
26760
26790
|
// Exact immutable family version adopted by this live variant. Legacy published rows
|
|
26761
26791
|
// have no manifest pin and use the one-time `publishedCanonicalInputs` snapshot instead.
|
|
26762
26792
|
publishedFamilyManifestId: text84("published_family_manifest_id"),
|
|
26763
26793
|
publishedFamilyManifestHash: varchar62("published_family_manifest_hash", { length: 64 }),
|
|
26764
|
-
publishedCanonicalInputs:
|
|
26794
|
+
publishedCanonicalInputs: jsonb44("published_canonical_inputs").$type(),
|
|
26765
26795
|
// Placement governance (migration 0190). Existing rows were backfilled to ["*"] so
|
|
26766
26796
|
// rollout preserves the old everywhere-visible behaviour; new project components start
|
|
26767
26797
|
// with [] and are deliberately approved from the section picker. Tokens are
|
|
@@ -26796,12 +26826,12 @@ var components = pgTable83(
|
|
|
26796
26826
|
groupId: text84("group_id").references(() => componentGroups.id, { onDelete: "restrict" }),
|
|
26797
26827
|
// Stored as unknown[] to keep @bettercms-ai/db decoupled from @bettercms-ai/types,
|
|
26798
26828
|
// matching pages.block_json. Validated as ContentBlock[] at the API layer.
|
|
26799
|
-
blockJson:
|
|
26800
|
-
props:
|
|
26829
|
+
blockJson: jsonb44("block_json").$type().notNull().default([]),
|
|
26830
|
+
props: jsonb44("props").$type().notNull().default([]),
|
|
26801
26831
|
// The editor controls this component declares ({ controls, cascade }, migration 0384).
|
|
26802
26832
|
// Authoring chrome, DRAFT-only: outside the publish snapshot, so it never makes a component
|
|
26803
26833
|
// "changed". Null keeps the dashboard's global controls. Validated at the API layer.
|
|
26804
|
-
design:
|
|
26834
|
+
design: jsonb44("design").$type(),
|
|
26805
26835
|
// Draft/live split (migration 0186_component_draft_live_split.sql). `blockJson`/`props`
|
|
26806
26836
|
// above are the DRAFT; these two are the LIVE snapshot that get_components_by_handle()
|
|
26807
26837
|
// serves. Nullable: a never-published component has no live copy. A DB trigger fills them
|
|
@@ -26809,8 +26839,8 @@ var components = pgTable83(
|
|
|
26809
26839
|
// trigger deliberately skips published -> published, or every autosave would go live).
|
|
26810
26840
|
// `props` splits alongside `blockJson` because applyOverrides() targets
|
|
26811
26841
|
// props[].target.blockId/path — a live tree paired with draft prop-defs mis-targets.
|
|
26812
|
-
publishedBlockJson:
|
|
26813
|
-
publishedProps:
|
|
26842
|
+
publishedBlockJson: jsonb44("published_block_json").$type(),
|
|
26843
|
+
publishedProps: jsonb44("published_props").$type(),
|
|
26814
26844
|
status: varchar62("status", { length: 20 }).$type().notNull().default("draft"),
|
|
26815
26845
|
publishedAt: timestamp76("published_at"),
|
|
26816
26846
|
// Out of the working set, still serving (FLO-1012). Deliberately NOT a third `status`
|
|
@@ -26864,7 +26894,7 @@ var components = pgTable83(
|
|
|
26864
26894
|
* src/lib/sections/registry.ts, which is handed every candidate and applies precedence
|
|
26865
26895
|
* itself. DB uniqueness here is data hygiene, not verdict correctness.
|
|
26866
26896
|
*/
|
|
26867
|
-
|
|
26897
|
+
uniqueIndex36("components_ws_proj_slug_managed_idx").on(table.workspaceId, table.projectId, table.branchId, table.slug, table.managedBy).where(sql19`${table.deletedAt} IS NULL`),
|
|
26868
26898
|
index70("components_managed_by_idx").on(table.managedBy).where(sql19`${table.deletedAt} IS NULL`),
|
|
26869
26899
|
// Partial: the section library only reads live sections. Mirrors migration 0156 —
|
|
26870
26900
|
// keep the two in step, or `drizzle-kit push` will want to drop the index it can't see.
|
|
@@ -26891,13 +26921,13 @@ var componentsRelations = relations14(components, ({ one }) => ({
|
|
|
26891
26921
|
}));
|
|
26892
26922
|
|
|
26893
26923
|
// src/schema/content_navigation.ts
|
|
26894
|
-
import { foreignKey as foreignKey5, index as index71, integer as integer40, jsonb as
|
|
26924
|
+
import { foreignKey as foreignKey5, index as index71, integer as integer40, jsonb as jsonb45, pgTable as pgTable84, text as text85, timestamp as timestamp77 } from "drizzle-orm/pg-core";
|
|
26895
26925
|
var contentNavigation = pgTable84(
|
|
26896
26926
|
"content_navigation",
|
|
26897
26927
|
{
|
|
26898
26928
|
projectId: text85("project_id").primaryKey(),
|
|
26899
26929
|
workspaceId: text85("workspace_id").notNull().references(() => workspaces.id, { onDelete: "cascade" }),
|
|
26900
|
-
doc:
|
|
26930
|
+
doc: jsonb45("doc").$type().notNull().default({ schema: 1, folders: [], items: [] }),
|
|
26901
26931
|
version: integer40("version").notNull().default(1),
|
|
26902
26932
|
updatedBy: text85("updated_by"),
|
|
26903
26933
|
createdAt: timestamp77("created_at").notNull().defaultNow(),
|
|
@@ -26919,11 +26949,11 @@ import {
|
|
|
26919
26949
|
text as text86,
|
|
26920
26950
|
varchar as varchar63,
|
|
26921
26951
|
timestamp as timestamp78,
|
|
26922
|
-
jsonb as
|
|
26952
|
+
jsonb as jsonb46,
|
|
26923
26953
|
integer as integer41,
|
|
26924
26954
|
index as index72,
|
|
26925
26955
|
unique as unique4,
|
|
26926
|
-
uniqueIndex as
|
|
26956
|
+
uniqueIndex as uniqueIndex37
|
|
26927
26957
|
} from "drizzle-orm/pg-core";
|
|
26928
26958
|
import { relations as relations15 } from "drizzle-orm/relations";
|
|
26929
26959
|
import { sql as sql20 } from "drizzle-orm";
|
|
@@ -26936,7 +26966,7 @@ var componentVariants = pgTable85(
|
|
|
26936
26966
|
name: varchar63("name", { length: 255 }).notNull(),
|
|
26937
26967
|
// `<component-root>-<variant-name>`, e.g. `footer-compact`.
|
|
26938
26968
|
key: varchar63("key", { length: 356 }).notNull(),
|
|
26939
|
-
delta:
|
|
26969
|
+
delta: jsonb46("delta").$type().notNull().default({
|
|
26940
26970
|
fieldOverrides: [],
|
|
26941
26971
|
addedProps: [],
|
|
26942
26972
|
removedFieldKeys: [],
|
|
@@ -26944,7 +26974,7 @@ var componentVariants = pgTable85(
|
|
|
26944
26974
|
valueOverrides: {},
|
|
26945
26975
|
addedBlocks: []
|
|
26946
26976
|
}),
|
|
26947
|
-
publishedDelta:
|
|
26977
|
+
publishedDelta: jsonb46("published_delta").$type(),
|
|
26948
26978
|
status: varchar63("status", { length: 20 }).$type().notNull().default("draft"),
|
|
26949
26979
|
publishedAt: timestamp78("published_at"),
|
|
26950
26980
|
optimisticVersion: integer41("optimistic_version").notNull().default(0),
|
|
@@ -26960,7 +26990,7 @@ var componentVariants = pgTable85(
|
|
|
26960
26990
|
),
|
|
26961
26991
|
index72("component_variants_workspace_idx").on(table.workspaceId),
|
|
26962
26992
|
index72("component_variants_component_idx").on(table.componentId),
|
|
26963
|
-
|
|
26993
|
+
uniqueIndex37("component_variants_component_key_unique").on(table.componentId, table.key).where(sql20`${table.deletedAt} IS NULL`)
|
|
26964
26994
|
]
|
|
26965
26995
|
);
|
|
26966
26996
|
var componentVariantsRelations = relations15(componentVariants, ({ one }) => ({
|
|
@@ -26980,12 +27010,12 @@ import {
|
|
|
26980
27010
|
foreignKey as foreignKey6,
|
|
26981
27011
|
index as index73,
|
|
26982
27012
|
integer as integer42,
|
|
26983
|
-
jsonb as
|
|
27013
|
+
jsonb as jsonb47,
|
|
26984
27014
|
pgTable as pgTable86,
|
|
26985
27015
|
text as text87,
|
|
26986
27016
|
timestamp as timestamp79,
|
|
26987
27017
|
unique as unique5,
|
|
26988
|
-
uniqueIndex as
|
|
27018
|
+
uniqueIndex as uniqueIndex38,
|
|
26989
27019
|
uuid as uuid2,
|
|
26990
27020
|
varchar as varchar64
|
|
26991
27021
|
} from "drizzle-orm/pg-core";
|
|
@@ -27003,10 +27033,10 @@ var componentImplementationCandidates = pgTable86(
|
|
|
27003
27033
|
// Exact value-bearing family contract. Unlike `contract.canonicalInputs` (the
|
|
27004
27034
|
// renderer/schema projection), this snapshot deliberately retains defaults because it
|
|
27005
27035
|
// becomes the immutable public-input source pinned by each published variant.
|
|
27006
|
-
familyContract:
|
|
27036
|
+
familyContract: jsonb47("family_contract").$type(),
|
|
27007
27037
|
schemaHash: varchar64("schema_hash", { length: 64 }).notNull(),
|
|
27008
27038
|
brandContractHash: varchar64("brand_contract_hash", { length: 64 }).notNull(),
|
|
27009
|
-
contract:
|
|
27039
|
+
contract: jsonb47("contract").$type().notNull(),
|
|
27010
27040
|
createdBy: text87("created_by"),
|
|
27011
27041
|
createdAt: timestamp79("created_at").notNull().defaultNow()
|
|
27012
27042
|
},
|
|
@@ -27019,7 +27049,7 @@ var componentImplementationCandidates = pgTable86(
|
|
|
27019
27049
|
// v1 candidates (created before 0263) have no exact family-contract bytes. They must not
|
|
27020
27050
|
// occupy the v2 tuple: validation needs to append an exact candidate beside the legacy
|
|
27021
27051
|
// row instead of either mutating it or selecting it by matching hashes alone.
|
|
27022
|
-
|
|
27052
|
+
uniqueIndex38("component_implementation_candidate_exact_tuple_unique").on(
|
|
27023
27053
|
table.projectId,
|
|
27024
27054
|
table.componentId,
|
|
27025
27055
|
table.schemaHash,
|
|
@@ -27038,13 +27068,13 @@ var componentFamilyManifests = pgTable86(
|
|
|
27038
27068
|
projectId: text87("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
|
|
27039
27069
|
familyKey: text87("family_key").notNull(),
|
|
27040
27070
|
familyContractHash: varchar64("family_contract_hash", { length: 64 }).notNull(),
|
|
27041
|
-
familyContract:
|
|
27071
|
+
familyContract: jsonb47("family_contract").$type(),
|
|
27042
27072
|
commitSha: varchar64("commit_sha", { length: 64 }).notNull(),
|
|
27043
27073
|
adapterHash: varchar64("adapter_hash", { length: 64 }).notNull(),
|
|
27044
27074
|
manifestHash: varchar64("manifest_hash", { length: 64 }).notNull(),
|
|
27045
27075
|
previewOrigin: text87("preview_origin").notNull(),
|
|
27046
|
-
nativeViewports:
|
|
27047
|
-
adapter:
|
|
27076
|
+
nativeViewports: jsonb47("native_viewports").$type().notNull(),
|
|
27077
|
+
adapter: jsonb47("adapter").$type().notNull(),
|
|
27048
27078
|
createdBy: text87("created_by"),
|
|
27049
27079
|
createdAt: timestamp79("created_at").notNull().defaultNow()
|
|
27050
27080
|
},
|
|
@@ -27057,7 +27087,7 @@ var componentFamilyManifests = pgTable86(
|
|
|
27057
27087
|
unique5("component_family_manifests_scope_unique").on(table.id, table.projectId, table.familyKey),
|
|
27058
27088
|
unique5("component_family_manifests_id_project_unique").on(table.id, table.projectId),
|
|
27059
27089
|
unique5("component_family_manifests_evidence_unique").on(table.id, table.projectId, table.manifestHash),
|
|
27060
|
-
|
|
27090
|
+
uniqueIndex38("component_family_manifest_tuple_unique").on(table.projectId, table.familyKey, table.manifestHash),
|
|
27061
27091
|
index73("component_family_manifests_family_idx").on(table.projectId, table.familyKey, table.createdAt)
|
|
27062
27092
|
]
|
|
27063
27093
|
);
|
|
@@ -27081,9 +27111,9 @@ var componentImplementationRequests = pgTable86(
|
|
|
27081
27111
|
adapterHash: varchar64("adapter_hash", { length: 64 }),
|
|
27082
27112
|
familyManifestHash: varchar64("family_manifest_hash", { length: 64 }),
|
|
27083
27113
|
previewOrigin: text87("preview_origin"),
|
|
27084
|
-
nativeViewports:
|
|
27085
|
-
adapter:
|
|
27086
|
-
providerProvenance:
|
|
27114
|
+
nativeViewports: jsonb47("native_viewports").$type(),
|
|
27115
|
+
adapter: jsonb47("adapter").$type(),
|
|
27116
|
+
providerProvenance: jsonb47("provider_provenance").$type(),
|
|
27087
27117
|
claimedByApiKeyId: text87("claimed_by_api_key_id"),
|
|
27088
27118
|
claimCredentialHash: varchar64("claim_credential_hash", { length: 64 }),
|
|
27089
27119
|
claimCredentialExpiresAt: timestamp79("claim_credential_expires_at", { withTimezone: true }),
|
|
@@ -27112,7 +27142,7 @@ var componentImplementationRequests = pgTable86(
|
|
|
27112
27142
|
name: "component_implementation_requests_candidate_fkey"
|
|
27113
27143
|
}).onDelete("cascade"),
|
|
27114
27144
|
unique5("component_implementation_requests_scope_unique").on(table.id, table.projectId, table.componentId),
|
|
27115
|
-
|
|
27145
|
+
uniqueIndex38("component_implementation_requests_active_unique").on(table.projectId, table.componentId).where(sql21`${table.status} IN ('pending', 'claimed')`),
|
|
27116
27146
|
index73("component_implementation_requests_claimable_idx").on(table.projectId, table.status, table.expiresAt, table.createdAt)
|
|
27117
27147
|
]
|
|
27118
27148
|
);
|
|
@@ -27127,17 +27157,17 @@ var componentImplementationEvidence = pgTable86(
|
|
|
27127
27157
|
familyManifestId: text87("family_manifest_id").notNull(),
|
|
27128
27158
|
familyManifestHash: varchar64("family_manifest_hash", { length: 64 }).notNull(),
|
|
27129
27159
|
variantBindingHash: varchar64("variant_binding_hash", { length: 64 }).notNull(),
|
|
27130
|
-
variantBinding:
|
|
27160
|
+
variantBinding: jsonb47("variant_binding").$type().notNull(),
|
|
27131
27161
|
requestId: text87("request_id"),
|
|
27132
27162
|
schemaHash: varchar64("schema_hash", { length: 64 }).notNull(),
|
|
27133
27163
|
brandContractHash: varchar64("brand_contract_hash", { length: 64 }).notNull(),
|
|
27134
27164
|
commitSha: varchar64("commit_sha", { length: 64 }).notNull(),
|
|
27135
27165
|
adapterHash: varchar64("adapter_hash", { length: 64 }).notNull(),
|
|
27136
27166
|
previewOrigin: text87("preview_origin").notNull(),
|
|
27137
|
-
nativeViewports:
|
|
27138
|
-
adapter:
|
|
27167
|
+
nativeViewports: jsonb47("native_viewports").$type().notNull(),
|
|
27168
|
+
adapter: jsonb47("adapter").$type().notNull(),
|
|
27139
27169
|
status: varchar64("status", { length: 20 }).$type().notNull(),
|
|
27140
|
-
checks:
|
|
27170
|
+
checks: jsonb47("checks").$type().notNull(),
|
|
27141
27171
|
evidenceDigest: varchar64("evidence_digest", { length: 128 }).notNull(),
|
|
27142
27172
|
evidenceTupleHash: varchar64("evidence_tuple_hash", { length: 64 }).notNull(),
|
|
27143
27173
|
createdBy: text87("created_by"),
|
|
@@ -27164,8 +27194,8 @@ var componentImplementationEvidence = pgTable86(
|
|
|
27164
27194
|
foreignColumns: [componentImplementationRequests.id, componentImplementationRequests.projectId, componentImplementationRequests.componentId],
|
|
27165
27195
|
name: "component_implementation_evidence_request_fkey"
|
|
27166
27196
|
}).onDelete("restrict"),
|
|
27167
|
-
|
|
27168
|
-
|
|
27197
|
+
uniqueIndex38("component_implementation_evidence_digest_unique").on(table.projectId, table.componentId, table.evidenceDigest),
|
|
27198
|
+
uniqueIndex38("component_implementation_evidence_request_unique").on(table.requestId).where(sql21`${table.requestId} IS NOT NULL`),
|
|
27169
27199
|
unique5("component_implementation_evidence_scope_unique").on(table.id, table.projectId, table.componentId),
|
|
27170
27200
|
index73("component_implementation_evidence_candidate_idx").on(table.candidateId, table.createdAt)
|
|
27171
27201
|
]
|
|
@@ -27198,7 +27228,7 @@ var componentImplementationApprovals = pgTable86(
|
|
|
27198
27228
|
foreignColumns: [componentImplementationEvidence.id, componentImplementationEvidence.projectId, componentImplementationEvidence.componentId],
|
|
27199
27229
|
name: "component_implementation_approvals_evidence_fkey"
|
|
27200
27230
|
}).onDelete("cascade"),
|
|
27201
|
-
|
|
27231
|
+
uniqueIndex38("component_implementation_approval_evidence_unique").on(table.evidenceId),
|
|
27202
27232
|
unique5("component_implementation_approval_scope_unique").on(table.id, table.projectId, table.componentId),
|
|
27203
27233
|
index73("component_implementation_approvals_component_idx").on(table.projectId, table.componentId)
|
|
27204
27234
|
]
|
|
@@ -27214,7 +27244,7 @@ var componentImplementationAdapters = pgTable86(
|
|
|
27214
27244
|
workspaceId: text87("workspace_id").notNull().references(() => workspaces.id, { onDelete: "cascade" }),
|
|
27215
27245
|
projectId: text87("project_id").notNull(),
|
|
27216
27246
|
componentId: text87("component_id").notNull().references(() => components.id, { onDelete: "cascade" }),
|
|
27217
|
-
adapter:
|
|
27247
|
+
adapter: jsonb47("adapter").$type().notNull(),
|
|
27218
27248
|
adapterHash: varchar64("adapter_hash", { length: 64 }).notNull(),
|
|
27219
27249
|
source: varchar64("source", { length: 24 }).$type().notNull(),
|
|
27220
27250
|
declaredBy: text87("declared_by"),
|
|
@@ -27259,7 +27289,7 @@ var componentImplementationStates = pgTable86(
|
|
|
27259
27289
|
foreignColumns: [projects.id, projects.workspaceId],
|
|
27260
27290
|
name: "component_implementation_states_project_workspace_fkey"
|
|
27261
27291
|
}).onDelete("cascade"),
|
|
27262
|
-
|
|
27292
|
+
uniqueIndex38("component_implementation_states_component_unique").on(table.projectId, table.componentId),
|
|
27263
27293
|
index73("component_implementation_states_workspace_idx").on(table.workspaceId)
|
|
27264
27294
|
]
|
|
27265
27295
|
);
|
|
@@ -27327,13 +27357,13 @@ import {
|
|
|
27327
27357
|
foreignKey as foreignKey7,
|
|
27328
27358
|
index as index74,
|
|
27329
27359
|
integer as integer43,
|
|
27330
|
-
jsonb as
|
|
27360
|
+
jsonb as jsonb48,
|
|
27331
27361
|
pgTable as pgTable87,
|
|
27332
27362
|
primaryKey as primaryKey6,
|
|
27333
27363
|
text as text88,
|
|
27334
27364
|
timestamp as timestamp80,
|
|
27335
27365
|
unique as unique6,
|
|
27336
|
-
uniqueIndex as
|
|
27366
|
+
uniqueIndex as uniqueIndex39,
|
|
27337
27367
|
uuid as uuid3,
|
|
27338
27368
|
varchar as varchar65
|
|
27339
27369
|
} from "drizzle-orm/pg-core";
|
|
@@ -27377,7 +27407,7 @@ var orchestrationRuns = pgTable87(
|
|
|
27377
27407
|
targetKind: varchar65("target_kind", { length: 32 }).$type().notNull().default("component-variant"),
|
|
27378
27408
|
targetId: text88("target_id").notNull().references(() => components.id, { onDelete: "no action" }),
|
|
27379
27409
|
targetVariantId: text88("target_variant_id"),
|
|
27380
|
-
targetMetadata:
|
|
27410
|
+
targetMetadata: jsonb48("target_metadata").$type().notNull(),
|
|
27381
27411
|
status: varchar65("status", { length: 20 }).$type().notNull().default("open"),
|
|
27382
27412
|
activeStage: varchar65("active_stage", { length: 64 }).notNull().default("awaiting-executor"),
|
|
27383
27413
|
version: integer43("version").notNull().default(1),
|
|
@@ -27410,7 +27440,7 @@ var orchestrationRuns = pgTable87(
|
|
|
27410
27440
|
table.projectId,
|
|
27411
27441
|
table.startIdempotencyKey
|
|
27412
27442
|
),
|
|
27413
|
-
|
|
27443
|
+
uniqueIndex39("orchestration_runs_nonterminal_project_unique").on(table.projectId).where(sql22`${table.status} IN ('open', 'paused', 'cancelling')`),
|
|
27414
27444
|
index74("orchestration_runs_project_target_idx").on(
|
|
27415
27445
|
table.projectId,
|
|
27416
27446
|
table.targetKind,
|
|
@@ -27543,7 +27573,7 @@ var orchestrationRunEvents = pgTable87(
|
|
|
27543
27573
|
actorId: text88("actor_id").notNull(),
|
|
27544
27574
|
causationId: text88("causation_id"),
|
|
27545
27575
|
correlationId: text88("correlation_id"),
|
|
27546
|
-
payload:
|
|
27576
|
+
payload: jsonb48("payload").$type().notNull().default({}),
|
|
27547
27577
|
payloadDigest: varchar65("payload_digest", { length: 71 }).generatedAlwaysAs(
|
|
27548
27578
|
sql22`'sha256:' || encode(digest(payload::text, 'sha256'), 'hex')`
|
|
27549
27579
|
),
|
|
@@ -27585,7 +27615,7 @@ var orchestrationRunCommandResults = pgTable87(
|
|
|
27585
27615
|
resultingVersion: integer43("resulting_version").notNull(),
|
|
27586
27616
|
actorId: text88("actor_id").notNull(),
|
|
27587
27617
|
eventId: uuid3("event_id").notNull().references(() => orchestrationRunEvents.id, { onDelete: "cascade" }),
|
|
27588
|
-
resultPayload:
|
|
27618
|
+
resultPayload: jsonb48("result_payload").$type().notNull(),
|
|
27589
27619
|
createdAt: timestamp80("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
27590
27620
|
},
|
|
27591
27621
|
(table) => [
|
|
@@ -27631,12 +27661,12 @@ import {
|
|
|
27631
27661
|
foreignKey as foreignKey8,
|
|
27632
27662
|
index as index75,
|
|
27633
27663
|
integer as integer44,
|
|
27634
|
-
jsonb as
|
|
27664
|
+
jsonb as jsonb49,
|
|
27635
27665
|
pgTable as pgTable88,
|
|
27636
27666
|
text as text89,
|
|
27637
27667
|
timestamp as timestamp81,
|
|
27638
27668
|
unique as unique7,
|
|
27639
|
-
uniqueIndex as
|
|
27669
|
+
uniqueIndex as uniqueIndex40,
|
|
27640
27670
|
uuid as uuid4,
|
|
27641
27671
|
varchar as varchar66
|
|
27642
27672
|
} from "drizzle-orm/pg-core";
|
|
@@ -27689,7 +27719,7 @@ var orchestrationExecutorInstallations = pgTable88(
|
|
|
27689
27719
|
grantId: text89("grant_id").references(() => deviceAuthorizations.id, { onDelete: "cascade" }),
|
|
27690
27720
|
protocolVersion: varchar66("protocol_version", { length: 16 }).notNull(),
|
|
27691
27721
|
capabilityDigest: text89("capability_digest").notNull(),
|
|
27692
|
-
repositoryClaim:
|
|
27722
|
+
repositoryClaim: jsonb49("repository_claim").$type().notNull().default({}),
|
|
27693
27723
|
status: varchar66("status", { length: 20 }).$type().notNull().default("active"),
|
|
27694
27724
|
createdAt: timestamp81("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
27695
27725
|
updatedAt: timestamp81("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
@@ -27709,8 +27739,8 @@ var orchestrationExecutorInstallations = pgTable88(
|
|
|
27709
27739
|
table.projectId,
|
|
27710
27740
|
table.status
|
|
27711
27741
|
),
|
|
27712
|
-
|
|
27713
|
-
|
|
27742
|
+
uniqueIndex40("orchestration_executor_installations_grant_unique").on(table.projectId, table.grantId).where(sql23`${table.grantId} IS NOT NULL AND ${table.status} = 'active'`),
|
|
27743
|
+
uniqueIndex40("orchestration_executor_installations_dashboard_unique").on(table.projectId).where(sql23`${table.kind} = 'dashboard-agent' AND ${table.status} = 'active'`),
|
|
27714
27744
|
check6(
|
|
27715
27745
|
"orchestration_executor_installations_kind_check",
|
|
27716
27746
|
sql23`${table.kind} IN ('dashboard-agent', 'native-bridge')`
|
|
@@ -27913,8 +27943,8 @@ var orchestrationPlanSnapshots = pgTable88(
|
|
|
27913
27943
|
workspaceId: text89("workspace_id").notNull().references(() => workspaces.id, { onDelete: "cascade" }),
|
|
27914
27944
|
projectId: text89("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
|
|
27915
27945
|
baseHeadOid: varchar66("base_head_oid", { length: 64 }).notNull(),
|
|
27916
|
-
budget:
|
|
27917
|
-
files:
|
|
27946
|
+
budget: jsonb49("budget").notNull(),
|
|
27947
|
+
files: jsonb49("files").notNull(),
|
|
27918
27948
|
fileCount: integer44("file_count").notNull(),
|
|
27919
27949
|
byteCount: bigint5("byte_count", { mode: "number" }).notNull(),
|
|
27920
27950
|
createdAt: timestamp81("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
@@ -28027,9 +28057,9 @@ var orchestrationExecutionApprovals = pgTable88(
|
|
|
28027
28057
|
* other field on a row a human signed stays as unwritable as it was before. */
|
|
28028
28058
|
consumedAt: timestamp81("consumed_at", { withTimezone: true }),
|
|
28029
28059
|
consumedByAttemptId: uuid4("consumed_by_attempt_id"),
|
|
28030
|
-
pathPolicy:
|
|
28031
|
-
operationClasses:
|
|
28032
|
-
mutationBudget:
|
|
28060
|
+
pathPolicy: jsonb49("path_policy").$type().notNull().default({}),
|
|
28061
|
+
operationClasses: jsonb49("operation_classes").$type().notNull().default([]),
|
|
28062
|
+
mutationBudget: jsonb49("mutation_budget").$type().notNull().default({}),
|
|
28033
28063
|
planDigest: text89("plan_digest").notNull(),
|
|
28034
28064
|
capabilityDigest: text89("capability_digest").notNull(),
|
|
28035
28065
|
validationDigest: text89("validation_digest").notNull(),
|
|
@@ -28171,7 +28201,7 @@ var orchestrationExecutorLeases = pgTable88(
|
|
|
28171
28201
|
),
|
|
28172
28202
|
unique7("orchestration_executor_leases_epoch_unique").on(table.attemptId, table.leaseEpoch),
|
|
28173
28203
|
// Plan invariant 6, enforced in the database: a run has at most one active executor lease.
|
|
28174
|
-
|
|
28204
|
+
uniqueIndex40("orchestration_executor_leases_one_active_per_run").on(table.runId).where(sql23`${table.state} = 'active'`),
|
|
28175
28205
|
index75("orchestration_executor_leases_deadline_idx").on(table.heartbeatDeadline).where(sql23`${table.state} = 'active'`),
|
|
28176
28206
|
check6("orchestration_executor_leases_epoch_check", sql23`${table.leaseEpoch} >= 1`),
|
|
28177
28207
|
check6(
|
|
@@ -28211,7 +28241,7 @@ var orchestrationExecutorCommands = pgTable88(
|
|
|
28211
28241
|
kind: varchar66("kind", { length: 32 }).$type().notNull(),
|
|
28212
28242
|
idempotencyKey: text89("idempotency_key").notNull(),
|
|
28213
28243
|
expectedRunVersion: integer44("expected_run_version").notNull(),
|
|
28214
|
-
payload:
|
|
28244
|
+
payload: jsonb49("payload").$type().notNull().default({}),
|
|
28215
28245
|
payloadDigest: varchar66("payload_digest", { length: 71 }).generatedAlwaysAs(
|
|
28216
28246
|
sql23`'sha256:' || encode(digest(payload::text, 'sha256'), 'hex')`
|
|
28217
28247
|
),
|
|
@@ -28423,7 +28453,7 @@ var orchestrationPullRequestReceipts = pgTable88(
|
|
|
28423
28453
|
|
|
28424
28454
|
// src/schema/conversion_proposals.ts
|
|
28425
28455
|
import { sql as sql24 } from "drizzle-orm";
|
|
28426
|
-
import { check as check7, foreignKey as foreignKey9, index as index76, integer as integer45, jsonb as
|
|
28456
|
+
import { check as check7, foreignKey as foreignKey9, index as index76, integer as integer45, jsonb as jsonb50, pgTable as pgTable89, text as text90, timestamp as timestamp82, unique as unique8, uuid as uuid5, varchar as varchar67 } from "drizzle-orm/pg-core";
|
|
28427
28457
|
var CONVERSION_PROPOSAL_STATUSES = ["draft", "approved", "superseded"];
|
|
28428
28458
|
var conversionProposals = pgTable89(
|
|
28429
28459
|
"conversion_proposals",
|
|
@@ -28438,9 +28468,9 @@ var conversionProposals = pgTable89(
|
|
|
28438
28468
|
baseHeadOid: varchar67("base_head_oid", { length: 64 }).notNull(),
|
|
28439
28469
|
baseBranch: text90("base_branch").notNull(),
|
|
28440
28470
|
/** Brief paths whose `original` was not found in any source file. */
|
|
28441
|
-
unlocated:
|
|
28471
|
+
unlocated: jsonb50("unlocated").notNull().default(sql24`'[]'::jsonb`),
|
|
28442
28472
|
/** Files that matched a brief original but fell outside the acquisition caps. */
|
|
28443
|
-
omittedByCap:
|
|
28473
|
+
omittedByCap: jsonb50("omitted_by_cap").notNull().default(sql24`'[]'::jsonb`),
|
|
28444
28474
|
/**
|
|
28445
28475
|
* The codemod's receipt (migration 0296) — every path it bound, and every one it could not.
|
|
28446
28476
|
*
|
|
@@ -28448,7 +28478,7 @@ var conversionProposals = pgTable89(
|
|
|
28448
28478
|
* pending list for those, which is exactly the silent "nothing left to do" this lane refuses.
|
|
28449
28479
|
* Informative: `proposeConversion` re-derives every claim it acts on from the proposed files.
|
|
28450
28480
|
*/
|
|
28451
|
-
receipt:
|
|
28481
|
+
receipt: jsonb50("receipt"),
|
|
28452
28482
|
status: text90("status").notNull().default("draft"),
|
|
28453
28483
|
version: integer45("version").notNull().default(1),
|
|
28454
28484
|
idempotencyKey: text90("idempotency_key").notNull(),
|
|
@@ -28484,7 +28514,7 @@ var conversionProposals = pgTable89(
|
|
|
28484
28514
|
|
|
28485
28515
|
// src/schema/conversion_briefs_issued.ts
|
|
28486
28516
|
import { sql as sql25 } from "drizzle-orm";
|
|
28487
|
-
import { check as check8, foreignKey as foreignKey10, index as index77, jsonb as
|
|
28517
|
+
import { check as check8, foreignKey as foreignKey10, index as index77, jsonb as jsonb51, pgTable as pgTable90, text as text91, timestamp as timestamp83, unique as unique9, uuid as uuid6 } from "drizzle-orm/pg-core";
|
|
28488
28518
|
var conversionBriefsIssued = pgTable90(
|
|
28489
28519
|
"conversion_briefs_issued",
|
|
28490
28520
|
{
|
|
@@ -28494,13 +28524,13 @@ var conversionBriefsIssued = pgTable90(
|
|
|
28494
28524
|
/** sha256 of the canonical brief — `briefDigest`, computed identically by the codemod. */
|
|
28495
28525
|
briefDigest: text91("brief_digest").notNull(),
|
|
28496
28526
|
/** `[{ route, scope, path, kind, locator? }]` — every bindable path the brief listed. */
|
|
28497
|
-
paths:
|
|
28527
|
+
paths: jsonb51("paths").notNull().default(sql25`'[]'::jsonb`),
|
|
28498
28528
|
/**
|
|
28499
28529
|
* The codemod's account of the run against THIS digest (`submit_conversion_receipt`): which
|
|
28500
28530
|
* paths it rewrote, which it could not, and why. Null until one is submitted — a hand
|
|
28501
28531
|
* conversion never submits one and still counts toward coverage.
|
|
28502
28532
|
*/
|
|
28503
|
-
receipt:
|
|
28533
|
+
receipt: jsonb51("receipt"),
|
|
28504
28534
|
/** The LAST time this pin was issued. What a retention sweep keys on. */
|
|
28505
28535
|
issuedAt: timestamp83("issued_at", { withTimezone: true }).notNull().defaultNow()
|
|
28506
28536
|
},
|
|
@@ -28525,12 +28555,12 @@ import {
|
|
|
28525
28555
|
foreignKey as foreignKey11,
|
|
28526
28556
|
index as index78,
|
|
28527
28557
|
integer as integer46,
|
|
28528
|
-
jsonb as
|
|
28558
|
+
jsonb as jsonb52,
|
|
28529
28559
|
pgTable as pgTable91,
|
|
28530
28560
|
text as text92,
|
|
28531
28561
|
timestamp as timestamp84,
|
|
28532
28562
|
unique as unique10,
|
|
28533
|
-
uniqueIndex as
|
|
28563
|
+
uniqueIndex as uniqueIndex41,
|
|
28534
28564
|
uuid as uuid7,
|
|
28535
28565
|
varchar as varchar68
|
|
28536
28566
|
} from "drizzle-orm/pg-core";
|
|
@@ -28613,7 +28643,7 @@ var orchestrationValidationEnvelopes = pgTable91(
|
|
|
28613
28643
|
}).onDelete("set null"),
|
|
28614
28644
|
// One live envelope per (attempt, head): two validators can never both be authoritative for
|
|
28615
28645
|
// the same commit. The index arbitrates, so no read-then-write can lose the race.
|
|
28616
|
-
|
|
28646
|
+
uniqueIndex41("orchestration_validation_envelopes_one_live_per_head").on(table.attemptId, table.headSha).where(sql26`status IN ('queued', 'dispatched', 'action_required')`),
|
|
28617
28647
|
index78("orchestration_validation_envelopes_attempt_idx").on(
|
|
28618
28648
|
table.attemptId,
|
|
28619
28649
|
table.createdAt.desc()
|
|
@@ -28653,7 +28683,7 @@ var orchestrationValidationEvidence = pgTable91(
|
|
|
28653
28683
|
brandContractHash: varchar68("brand_contract_hash", { length: 64 }).notNull(),
|
|
28654
28684
|
status: varchar68("status", { length: 10 }).notNull(),
|
|
28655
28685
|
/** brandKit / runtime / visual. The shape is enforced by CHECK in 0273, not by the writer. */
|
|
28656
|
-
checks:
|
|
28686
|
+
checks: jsonb52("checks").notNull(),
|
|
28657
28687
|
createdBy: text92("created_by"),
|
|
28658
28688
|
createdAt: timestamp84("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
28659
28689
|
},
|
|
@@ -28692,7 +28722,7 @@ var orchestrationValidationEvidence = pgTable91(
|
|
|
28692
28722
|
|
|
28693
28723
|
// src/schema/orchestration_executor_grants.ts
|
|
28694
28724
|
import { sql as sql27 } from "drizzle-orm";
|
|
28695
|
-
import { check as check10, foreignKey as foreignKey12, index as index79, integer as integer47, pgTable as pgTable92, text as text93, timestamp as timestamp85, unique as unique11, uniqueIndex as
|
|
28725
|
+
import { check as check10, foreignKey as foreignKey12, index as index79, integer as integer47, pgTable as pgTable92, text as text93, timestamp as timestamp85, unique as unique11, uniqueIndex as uniqueIndex42, uuid as uuid8, varchar as varchar69 } from "drizzle-orm/pg-core";
|
|
28696
28726
|
var EXECUTOR_GRANT_STATUSES = ["active", "revoked", "expired"];
|
|
28697
28727
|
var orchestrationExecutorGrants = pgTable92(
|
|
28698
28728
|
"orchestration_executor_grants",
|
|
@@ -28731,7 +28761,7 @@ var orchestrationExecutorGrants = pgTable92(
|
|
|
28731
28761
|
}).onDelete("cascade"),
|
|
28732
28762
|
// One live credential per installation. Two would mean two processes can each present a valid
|
|
28733
28763
|
// one, and the exclusion argument collapses before the lease layer is reached.
|
|
28734
|
-
|
|
28764
|
+
uniqueIndex42("orchestration_executor_grants_one_active_per_installation").on(table.installationId).where(sql27`status = 'active'`),
|
|
28735
28765
|
index79("orchestration_executor_grants_credential_idx").on(table.workspaceId, table.credentialHash).where(sql27`status = 'active'`),
|
|
28736
28766
|
check10(
|
|
28737
28767
|
"orchestration_executor_grants_status_check",
|
|
@@ -28745,7 +28775,7 @@ var orchestrationExecutorGrants = pgTable92(
|
|
|
28745
28775
|
);
|
|
28746
28776
|
|
|
28747
28777
|
// src/schema/component_presets.ts
|
|
28748
|
-
import { pgTable as pgTable93, text as text94, varchar as varchar70, timestamp as timestamp86, jsonb as
|
|
28778
|
+
import { pgTable as pgTable93, text as text94, varchar as varchar70, timestamp as timestamp86, jsonb as jsonb53, integer as integer48, index as index80, uniqueIndex as uniqueIndex43 } from "drizzle-orm/pg-core";
|
|
28749
28779
|
import { relations as relations16 } from "drizzle-orm";
|
|
28750
28780
|
var componentPresets = pgTable93(
|
|
28751
28781
|
"component_presets",
|
|
@@ -28757,7 +28787,7 @@ var componentPresets = pgTable93(
|
|
|
28757
28787
|
/** ^[a-z0-9-]+$, unique per component — stable across renames. */
|
|
28758
28788
|
slug: varchar70("slug", { length: 255 }).notNull(),
|
|
28759
28789
|
/** Prop key → value. Validated against the component's `props` on every write. */
|
|
28760
|
-
values:
|
|
28790
|
+
values: jsonb53("values").$type().notNull().default({}),
|
|
28761
28791
|
position: integer48("position").notNull().default(0),
|
|
28762
28792
|
createdAt: timestamp86("created_at").notNull().defaultNow(),
|
|
28763
28793
|
updatedAt: timestamp86("updated_at").notNull().defaultNow(),
|
|
@@ -28766,7 +28796,7 @@ var componentPresets = pgTable93(
|
|
|
28766
28796
|
},
|
|
28767
28797
|
(t) => [
|
|
28768
28798
|
index80("component_presets_component_position_idx").on(t.componentId, t.position, t.createdAt, t.id),
|
|
28769
|
-
|
|
28799
|
+
uniqueIndex43("component_presets_component_slug_key").on(t.componentId, t.slug)
|
|
28770
28800
|
]
|
|
28771
28801
|
);
|
|
28772
28802
|
var componentPresetsRelations = relations16(componentPresets, ({ one }) => ({
|
|
@@ -28781,12 +28811,12 @@ import {
|
|
|
28781
28811
|
foreignKey as foreignKey13,
|
|
28782
28812
|
index as index81,
|
|
28783
28813
|
integer as integer49,
|
|
28784
|
-
jsonb as
|
|
28814
|
+
jsonb as jsonb54,
|
|
28785
28815
|
pgTable as pgTable94,
|
|
28786
28816
|
text as text95,
|
|
28787
28817
|
timestamp as timestamp87,
|
|
28788
28818
|
unique as unique12,
|
|
28789
|
-
uniqueIndex as
|
|
28819
|
+
uniqueIndex as uniqueIndex44,
|
|
28790
28820
|
varchar as varchar71
|
|
28791
28821
|
} from "drizzle-orm/pg-core";
|
|
28792
28822
|
import { sql as sql28 } from "drizzle-orm";
|
|
@@ -28816,7 +28846,7 @@ var sectionDefinitions = pgTable94(
|
|
|
28816
28846
|
name: "section_definitions_project_workspace_fkey"
|
|
28817
28847
|
}).onDelete("cascade").onUpdate("cascade"),
|
|
28818
28848
|
unique12("section_definitions_id_project_unique").on(table.id, table.projectId),
|
|
28819
|
-
|
|
28849
|
+
uniqueIndex44("section_definitions_project_api_id_unique").on(table.projectId, table.apiId),
|
|
28820
28850
|
index81("section_definitions_workspace_idx").on(table.workspaceId),
|
|
28821
28851
|
index81("section_definitions_project_idx").on(table.projectId)
|
|
28822
28852
|
]
|
|
@@ -28830,7 +28860,7 @@ var sectionDefinitionVersions = pgTable94(
|
|
|
28830
28860
|
sectionDefinitionId: text95("section_definition_id").notNull(),
|
|
28831
28861
|
version: integer49("version").notNull(),
|
|
28832
28862
|
label: varchar71("label", { length: 255 }).notNull(),
|
|
28833
|
-
fields:
|
|
28863
|
+
fields: jsonb54("fields").$type().notNull().default([]),
|
|
28834
28864
|
schemaHash: varchar71("schema_hash", { length: 64 }).notNull(),
|
|
28835
28865
|
createdBy: text95("created_by"),
|
|
28836
28866
|
createdAt: timestamp87("created_at").notNull().defaultNow()
|
|
@@ -28875,7 +28905,7 @@ var sectionZones = pgTable94(
|
|
|
28875
28905
|
name: "section_zones_project_workspace_fkey"
|
|
28876
28906
|
}).onDelete("cascade").onUpdate("cascade"),
|
|
28877
28907
|
unique12("section_zones_id_project_unique").on(table.id, table.projectId),
|
|
28878
|
-
|
|
28908
|
+
uniqueIndex44("section_zones_schema_owner_unique").on(table.projectId, table.schemaKind, table.schemaId),
|
|
28879
28909
|
index81("section_zones_workspace_idx").on(table.workspaceId)
|
|
28880
28910
|
]
|
|
28881
28911
|
);
|
|
@@ -28926,7 +28956,7 @@ var sectionZoneAttachments = pgTable94(
|
|
|
28926
28956
|
],
|
|
28927
28957
|
name: "section_zone_attachments_published_version_fkey"
|
|
28928
28958
|
}).onDelete("restrict"),
|
|
28929
|
-
|
|
28959
|
+
uniqueIndex44("section_zone_attachments_zone_definition_unique").on(table.zoneId, table.sectionDefinitionId),
|
|
28930
28960
|
index81("section_zone_attachments_zone_position_idx").on(table.zoneId, table.position, table.id)
|
|
28931
28961
|
]
|
|
28932
28962
|
);
|
|
@@ -28941,7 +28971,7 @@ var sectionManifests = pgTable94(
|
|
|
28941
28971
|
apiId: varchar71("api_id", { length: 100 }).notNull(),
|
|
28942
28972
|
schemaHash: varchar71("schema_hash", { length: 64 }).notNull(),
|
|
28943
28973
|
commitSha: varchar71("commit_sha", { length: 64 }).notNull(),
|
|
28944
|
-
manifest:
|
|
28974
|
+
manifest: jsonb54("manifest").$type().notNull(),
|
|
28945
28975
|
createdBy: text95("created_by"),
|
|
28946
28976
|
createdAt: timestamp87("created_at").notNull().defaultNow()
|
|
28947
28977
|
},
|
|
@@ -28978,7 +29008,7 @@ var sectionValidationRuns = pgTable94(
|
|
|
28978
29008
|
commitSha: varchar71("commit_sha", { length: 64 }).notNull(),
|
|
28979
29009
|
fixtureHash: varchar71("fixture_hash", { length: 64 }).notNull(),
|
|
28980
29010
|
evidenceDigest: varchar71("evidence_digest", { length: 128 }).notNull(),
|
|
28981
|
-
results:
|
|
29011
|
+
results: jsonb54("results").$type().notNull(),
|
|
28982
29012
|
createdBy: text95("created_by"),
|
|
28983
29013
|
createdAt: timestamp87("created_at").notNull().defaultNow()
|
|
28984
29014
|
},
|
|
@@ -29105,7 +29135,7 @@ var sectionImplementationRequests = pgTable94(
|
|
|
29105
29135
|
name: "section_implementation_requests_validation_project_fkey"
|
|
29106
29136
|
}).onDelete("restrict"),
|
|
29107
29137
|
unique12("section_implementation_requests_id_project_unique").on(table.id, table.projectId),
|
|
29108
|
-
|
|
29138
|
+
uniqueIndex44("section_implementation_requests_one_active_unique").on(table.projectId, table.sectionDefinitionId, table.sectionVersion, table.schemaHash).where(sql28`${table.status} IN ('queued', 'dispatching', 'dispatched', 'running')`),
|
|
29109
29139
|
index81("section_implementation_requests_project_created_idx").on(table.projectId, table.createdAt)
|
|
29110
29140
|
]
|
|
29111
29141
|
);
|
|
@@ -29117,7 +29147,7 @@ var sectionZoneReleases = pgTable94(
|
|
|
29117
29147
|
projectId: text95("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
|
|
29118
29148
|
zoneId: text95("zone_id").notNull(),
|
|
29119
29149
|
revision: integer49("revision").notNull(),
|
|
29120
|
-
snapshot:
|
|
29150
|
+
snapshot: jsonb54("snapshot").$type().notNull(),
|
|
29121
29151
|
publishedBy: text95("published_by").notNull(),
|
|
29122
29152
|
publishedAt: timestamp87("published_at").notNull().defaultNow()
|
|
29123
29153
|
},
|
|
@@ -29138,7 +29168,7 @@ var sectionZoneReleases = pgTable94(
|
|
|
29138
29168
|
);
|
|
29139
29169
|
|
|
29140
29170
|
// src/schema/content_locks.ts
|
|
29141
|
-
import { check as check11, index as index82, jsonb as
|
|
29171
|
+
import { check as check11, index as index82, jsonb as jsonb55, pgTable as pgTable95, text as text96, timestamp as timestamp88 } from "drizzle-orm/pg-core";
|
|
29142
29172
|
import { sql as sql29 } from "drizzle-orm";
|
|
29143
29173
|
var CONTENT_LOCK_TARGET_KINDS = [
|
|
29144
29174
|
"page",
|
|
@@ -29158,7 +29188,7 @@ var contentLocks = pgTable95(
|
|
|
29158
29188
|
blockId: text96("block_id"),
|
|
29159
29189
|
// Deterministic structural path plus block ancestry captured when the lock is created.
|
|
29160
29190
|
// Nullable so Wave 5 remains compatible with locks created before this fingerprint existed.
|
|
29161
|
-
blockFingerprint:
|
|
29191
|
+
blockFingerprint: jsonb55("block_fingerprint").$type(),
|
|
29162
29192
|
fieldPath: text96("field_path").array(),
|
|
29163
29193
|
mode: text96("mode").$type().notNull().default("all"),
|
|
29164
29194
|
reason: text96("reason"),
|
|
@@ -29191,7 +29221,7 @@ import {
|
|
|
29191
29221
|
varchar as varchar72,
|
|
29192
29222
|
timestamp as timestamp89,
|
|
29193
29223
|
index as index83,
|
|
29194
|
-
uniqueIndex as
|
|
29224
|
+
uniqueIndex as uniqueIndex45
|
|
29195
29225
|
} from "drizzle-orm/pg-core";
|
|
29196
29226
|
import { sql as sql30 } from "drizzle-orm";
|
|
29197
29227
|
var projectTransfers = pgTable96(
|
|
@@ -29229,7 +29259,7 @@ var projectTransfers = pgTable96(
|
|
|
29229
29259
|
(table) => [
|
|
29230
29260
|
// At most one OPEN transfer per project. Partial-unique so completed/declined/
|
|
29231
29261
|
// cancelled/expired/failed rows never wedge a re-initiation.
|
|
29232
|
-
|
|
29262
|
+
uniqueIndex45("project_transfers_one_pending_idx").on(table.projectId).where(sql30`${table.status} = 'pending'`),
|
|
29233
29263
|
// Recipient inbox lookup (GET /me/transfers by email + status).
|
|
29234
29264
|
index83("project_transfers_recipient_idx").on(
|
|
29235
29265
|
table.recipientEmail,
|
|
@@ -29239,7 +29269,7 @@ var projectTransfers = pgTable96(
|
|
|
29239
29269
|
index83("project_transfers_from_ws_idx").on(table.fromWorkspaceId),
|
|
29240
29270
|
index83("project_transfers_project_idx").on(table.projectId),
|
|
29241
29271
|
// Magic-link resolution.
|
|
29242
|
-
|
|
29272
|
+
uniqueIndex45("project_transfers_token_idx").on(table.token),
|
|
29243
29273
|
// Expiry sweep — only pending rows are ever candidates.
|
|
29244
29274
|
index83("project_transfers_expires_idx").on(table.expiresAt).where(sql30`${table.status} = 'pending'`)
|
|
29245
29275
|
]
|
|
@@ -29252,7 +29282,7 @@ import {
|
|
|
29252
29282
|
varchar as varchar73,
|
|
29253
29283
|
integer as integer50,
|
|
29254
29284
|
bigint as bigint7,
|
|
29255
|
-
jsonb as
|
|
29285
|
+
jsonb as jsonb56,
|
|
29256
29286
|
timestamp as timestamp90,
|
|
29257
29287
|
index as index84
|
|
29258
29288
|
} from "drizzle-orm/pg-core";
|
|
@@ -29280,12 +29310,12 @@ var backups = pgTable97(
|
|
|
29280
29310
|
manifestVersion: integer50("manifest_version").notNull().default(1),
|
|
29281
29311
|
// forward-compat
|
|
29282
29312
|
sizeBytes: bigint7("size_bytes", { mode: "number" }),
|
|
29283
|
-
counts:
|
|
29313
|
+
counts: jsonb56("counts").$type().notNull().default({}),
|
|
29284
29314
|
// R2 object keys this snapshot references. Powers the media-GC hold:
|
|
29285
29315
|
// `list_backup_referenced_media_keys()` keeps these keys alive while the
|
|
29286
29316
|
// backup is live, so a restore never finds a garbage-collected object.
|
|
29287
|
-
mediaKeys:
|
|
29288
|
-
scope:
|
|
29317
|
+
mediaKeys: jsonb56("media_keys").$type().notNull().default([]),
|
|
29318
|
+
scope: jsonb56("scope").$type().notNull().default(FULL_BACKUP_SCOPE),
|
|
29289
29319
|
error: text98("error"),
|
|
29290
29320
|
createdBy: text98("created_by"),
|
|
29291
29321
|
// FK → users(id); NULL = system-initiated
|
|
@@ -29307,7 +29337,7 @@ import {
|
|
|
29307
29337
|
text as text99,
|
|
29308
29338
|
varchar as varchar74,
|
|
29309
29339
|
integer as integer51,
|
|
29310
|
-
jsonb as
|
|
29340
|
+
jsonb as jsonb57,
|
|
29311
29341
|
timestamp as timestamp91,
|
|
29312
29342
|
index as index85
|
|
29313
29343
|
} from "drizzle-orm/pg-core";
|
|
@@ -29327,7 +29357,7 @@ var backupJobs = pgTable98(
|
|
|
29327
29357
|
workingSince: timestamp91("working_since", { withTimezone: true }),
|
|
29328
29358
|
attempts: integer51("attempts").notNull().default(0),
|
|
29329
29359
|
error: text99("error"),
|
|
29330
|
-
payload:
|
|
29360
|
+
payload: jsonb57("payload").$type().notNull().default({}),
|
|
29331
29361
|
createdAt: timestamp91("created_at").notNull().defaultNow(),
|
|
29332
29362
|
updatedAt: timestamp91("updated_at").notNull().defaultNow()
|
|
29333
29363
|
},
|
|
@@ -29338,7 +29368,7 @@ var backupJobs = pgTable98(
|
|
|
29338
29368
|
);
|
|
29339
29369
|
|
|
29340
29370
|
// src/schema/clone_links.ts
|
|
29341
|
-
import { pgTable as pgTable99, text as text100, boolean as boolean31, jsonb as
|
|
29371
|
+
import { pgTable as pgTable99, text as text100, boolean as boolean31, jsonb as jsonb58, timestamp as timestamp92, index as index86 } from "drizzle-orm/pg-core";
|
|
29342
29372
|
var cloneLinks = pgTable99(
|
|
29343
29373
|
"clone_links",
|
|
29344
29374
|
{
|
|
@@ -29351,7 +29381,7 @@ var cloneLinks = pgTable99(
|
|
|
29351
29381
|
token: text100("token").notNull(),
|
|
29352
29382
|
// public share token (nanoid); unique among active links
|
|
29353
29383
|
enabled: boolean31("enabled").notNull().default(true),
|
|
29354
|
-
scope:
|
|
29384
|
+
scope: jsonb58("scope").$type().notNull(),
|
|
29355
29385
|
createdBy: text100("created_by"),
|
|
29356
29386
|
// FK → users(id); NULL = system-initiated
|
|
29357
29387
|
createdAt: timestamp92("created_at").notNull().defaultNow(),
|
|
@@ -29366,7 +29396,7 @@ var cloneLinks = pgTable99(
|
|
|
29366
29396
|
);
|
|
29367
29397
|
|
|
29368
29398
|
// src/schema/clone_jobs.ts
|
|
29369
|
-
import { pgTable as pgTable100, text as text101, varchar as varchar75, integer as integer52, jsonb as
|
|
29399
|
+
import { pgTable as pgTable100, text as text101, varchar as varchar75, integer as integer52, jsonb as jsonb59, timestamp as timestamp93, index as index87, uniqueIndex as uniqueIndex46 } from "drizzle-orm/pg-core";
|
|
29370
29400
|
import { sql as sql31 } from "drizzle-orm";
|
|
29371
29401
|
var cloneJobs = pgTable100(
|
|
29372
29402
|
"clone_jobs",
|
|
@@ -29387,7 +29417,7 @@ var cloneJobs = pgTable100(
|
|
|
29387
29417
|
workingSince: timestamp93("working_since", { withTimezone: true }),
|
|
29388
29418
|
attempts: integer52("attempts").notNull().default(0),
|
|
29389
29419
|
error: text101("error"),
|
|
29390
|
-
payload:
|
|
29420
|
+
payload: jsonb59("payload").$type().notNull().default({}),
|
|
29391
29421
|
// Which post-clone work the drain owes a finished job. 'clone' = none, today's behaviour.
|
|
29392
29422
|
// Migration 0343.
|
|
29393
29423
|
purpose: varchar75("purpose", { length: 32 }).notNull().default("clone"),
|
|
@@ -29401,7 +29431,7 @@ var cloneJobs = pgTable100(
|
|
|
29401
29431
|
index87("clone_jobs_workspace_idx").on(t.workspaceId),
|
|
29402
29432
|
// One unfinished hybrid→headless switch per source (0343). The route maps its 23505 to
|
|
29403
29433
|
// SWITCH_ALREADY_PENDING.
|
|
29404
|
-
|
|
29434
|
+
uniqueIndex46("clone_jobs_mode_switch_active_uniq").on(t.sourceProjectId).where(sql31`${t.purpose} = 'mode_switch' AND ${t.status} IN ('pending', 'working')`)
|
|
29405
29435
|
]
|
|
29406
29436
|
);
|
|
29407
29437
|
|
|
@@ -29413,7 +29443,7 @@ import {
|
|
|
29413
29443
|
varchar as varchar76,
|
|
29414
29444
|
timestamp as timestamp94,
|
|
29415
29445
|
index as index88,
|
|
29416
|
-
uniqueIndex as
|
|
29446
|
+
uniqueIndex as uniqueIndex47
|
|
29417
29447
|
} from "drizzle-orm/pg-core";
|
|
29418
29448
|
import { sql as sql32 } from "drizzle-orm";
|
|
29419
29449
|
var projectBranches = pgTable101(
|
|
@@ -29434,7 +29464,7 @@ var projectBranches = pgTable101(
|
|
|
29434
29464
|
},
|
|
29435
29465
|
(t) => [
|
|
29436
29466
|
index88("project_branches_project_idx").on(t.projectId),
|
|
29437
|
-
|
|
29467
|
+
uniqueIndex47("project_branches_project_slug_open_idx").on(t.projectId, t.slug).where(sql32`${t.status} = 'open'`)
|
|
29438
29468
|
]
|
|
29439
29469
|
);
|
|
29440
29470
|
var branchRowSyncs = pgTable101(
|
|
@@ -29454,7 +29484,7 @@ var branchRowSyncs = pgTable101(
|
|
|
29454
29484
|
);
|
|
29455
29485
|
|
|
29456
29486
|
// src/schema/branch_preview_share.ts
|
|
29457
|
-
import { pgTable as pgTable102, text as text103, boolean as boolean32, timestamp as timestamp95, index as index89, uniqueIndex as
|
|
29487
|
+
import { pgTable as pgTable102, text as text103, boolean as boolean32, timestamp as timestamp95, index as index89, uniqueIndex as uniqueIndex48 } from "drizzle-orm/pg-core";
|
|
29458
29488
|
var branchPreviewShares = pgTable102(
|
|
29459
29489
|
"branch_preview_shares",
|
|
29460
29490
|
{
|
|
@@ -29469,8 +29499,8 @@ var branchPreviewShares = pgTable102(
|
|
|
29469
29499
|
updatedAt: timestamp95("updated_at").notNull().defaultNow()
|
|
29470
29500
|
},
|
|
29471
29501
|
(t) => [
|
|
29472
|
-
|
|
29473
|
-
|
|
29502
|
+
uniqueIndex48("branch_preview_shares_branch_idx").on(t.branchId),
|
|
29503
|
+
uniqueIndex48("branch_preview_shares_active_token_idx").on(t.publicToken),
|
|
29474
29504
|
index89("branch_preview_shares_project_idx").on(t.projectId),
|
|
29475
29505
|
index89("branch_preview_shares_workspace_idx").on(t.workspaceId)
|
|
29476
29506
|
]
|
|
@@ -29487,7 +29517,7 @@ var branchPreviewGrants = pgTable102(
|
|
|
29487
29517
|
createdAt: timestamp95("created_at").notNull().defaultNow()
|
|
29488
29518
|
},
|
|
29489
29519
|
(t) => [
|
|
29490
|
-
|
|
29520
|
+
uniqueIndex48("branch_preview_grants_branch_email_idx").on(t.branchId, t.email),
|
|
29491
29521
|
index89("branch_preview_grants_project_idx").on(t.projectId)
|
|
29492
29522
|
]
|
|
29493
29523
|
);
|
|
@@ -29525,10 +29555,10 @@ import {
|
|
|
29525
29555
|
text as text105,
|
|
29526
29556
|
varchar as varchar77,
|
|
29527
29557
|
timestamp as timestamp97,
|
|
29528
|
-
jsonb as
|
|
29558
|
+
jsonb as jsonb60,
|
|
29529
29559
|
integer as integer53,
|
|
29530
29560
|
index as index91,
|
|
29531
|
-
uniqueIndex as
|
|
29561
|
+
uniqueIndex as uniqueIndex49
|
|
29532
29562
|
} from "drizzle-orm/pg-core";
|
|
29533
29563
|
import { relations as relations17 } from "drizzle-orm/relations";
|
|
29534
29564
|
import { sql as sql33 } from "drizzle-orm";
|
|
@@ -29553,7 +29583,7 @@ var templates = pgTable104(
|
|
|
29553
29583
|
thumbnail: varchar77("thumbnail", { length: 2048 }),
|
|
29554
29584
|
// Frozen snapshot manifest (stripped snapshot_project output). Never returned in
|
|
29555
29585
|
// list/gallery responses — only read server-side to instantiate.
|
|
29556
|
-
manifest:
|
|
29586
|
+
manifest: jsonb60("manifest").$type().notNull(),
|
|
29557
29587
|
visibility: varchar77("visibility", { length: 10 }).$type().notNull().default("private"),
|
|
29558
29588
|
sourceProjectId: text105("source_project_id"),
|
|
29559
29589
|
// provenance (nullable — source may be deleted later)
|
|
@@ -29569,7 +29599,7 @@ var templates = pgTable104(
|
|
|
29569
29599
|
index91("templates_workspace_idx").on(table.workspaceId),
|
|
29570
29600
|
// Partial: only live rows. A soft-deleted template frees its slug (mirrors
|
|
29571
29601
|
// components_ws_proj_slug_idx / migration 0114).
|
|
29572
|
-
|
|
29602
|
+
uniqueIndex49("templates_ws_slug_idx").on(table.workspaceId, table.slug).where(sql33`${table.deletedAt} IS NULL`),
|
|
29573
29603
|
// Public gallery scan (created_at DESC over live public rows).
|
|
29574
29604
|
index91("templates_public_idx").on(table.visibility).where(sql33`${table.visibility} = 'public' AND ${table.deletedAt} IS NULL`)
|
|
29575
29605
|
]
|
|
@@ -29641,7 +29671,7 @@ var planChanges = pgTable106(
|
|
|
29641
29671
|
);
|
|
29642
29672
|
|
|
29643
29673
|
// src/schema/billing_addons.ts
|
|
29644
|
-
import { pgTable as pgTable107, text as text108, varchar as varchar79, integer as integer55, boolean as boolean34, jsonb as
|
|
29674
|
+
import { pgTable as pgTable107, text as text108, varchar as varchar79, integer as integer55, boolean as boolean34, jsonb as jsonb61, index as index94 } from "drizzle-orm/pg-core";
|
|
29645
29675
|
var billingAddons = pgTable107(
|
|
29646
29676
|
"billing_addons",
|
|
29647
29677
|
{
|
|
@@ -29658,13 +29688,13 @@ var billingAddons = pgTable107(
|
|
|
29658
29688
|
// ai_credits packs only: credits granted per unit
|
|
29659
29689
|
recurring: boolean34("recurring").notNull().default(false),
|
|
29660
29690
|
// seats/localization/AB = true; credit packs = false
|
|
29661
|
-
metadata:
|
|
29691
|
+
metadata: jsonb61("metadata").$type().default({})
|
|
29662
29692
|
},
|
|
29663
29693
|
(t) => [index94("billing_addons_kind_idx").on(t.kind)]
|
|
29664
29694
|
);
|
|
29665
29695
|
|
|
29666
29696
|
// src/schema/billing_customers.ts
|
|
29667
|
-
import { pgTable as pgTable108, text as text109, varchar as varchar80, timestamp as timestamp100, uniqueIndex as
|
|
29697
|
+
import { pgTable as pgTable108, text as text109, varchar as varchar80, timestamp as timestamp100, uniqueIndex as uniqueIndex50 } from "drizzle-orm/pg-core";
|
|
29668
29698
|
var billingCustomers = pgTable108(
|
|
29669
29699
|
"billing_customers",
|
|
29670
29700
|
{
|
|
@@ -29678,13 +29708,13 @@ var billingCustomers = pgTable108(
|
|
|
29678
29708
|
updatedAt: timestamp100("updated_at").notNull().defaultNow()
|
|
29679
29709
|
},
|
|
29680
29710
|
(t) => [
|
|
29681
|
-
|
|
29682
|
-
|
|
29711
|
+
uniqueIndex50("billing_customers_workspace_idx").on(t.workspaceId),
|
|
29712
|
+
uniqueIndex50("billing_customers_dodo_idx").on(t.dodoCustomerId)
|
|
29683
29713
|
]
|
|
29684
29714
|
);
|
|
29685
29715
|
|
|
29686
29716
|
// src/schema/subscriptions.ts
|
|
29687
|
-
import { pgTable as pgTable109, text as text110, varchar as varchar81, boolean as boolean35, timestamp as timestamp101, index as index95, uniqueIndex as
|
|
29717
|
+
import { pgTable as pgTable109, text as text110, varchar as varchar81, boolean as boolean35, timestamp as timestamp101, index as index95, uniqueIndex as uniqueIndex51 } from "drizzle-orm/pg-core";
|
|
29688
29718
|
import { sql as sql34 } from "drizzle-orm";
|
|
29689
29719
|
var subscriptions = pgTable109(
|
|
29690
29720
|
"subscriptions",
|
|
@@ -29712,16 +29742,16 @@ var subscriptions = pgTable109(
|
|
|
29712
29742
|
},
|
|
29713
29743
|
(t) => [
|
|
29714
29744
|
index95("subscriptions_workspace_idx").on(t.workspaceId),
|
|
29715
|
-
|
|
29745
|
+
uniqueIndex51("subscriptions_dodo_idx").on(t.dodoSubscriptionId).where(sql34`${t.dodoSubscriptionId} IS NOT NULL`),
|
|
29716
29746
|
// At most one workspace-level subscription per workspace.
|
|
29717
|
-
|
|
29747
|
+
uniqueIndex51("subscriptions_workspace_plan_unique").on(t.workspaceId).where(sql34`${t.projectId} IS NULL`),
|
|
29718
29748
|
// At most one subscription per site.
|
|
29719
|
-
|
|
29749
|
+
uniqueIndex51("subscriptions_project_unique").on(t.projectId).where(sql34`${t.projectId} IS NOT NULL`)
|
|
29720
29750
|
]
|
|
29721
29751
|
);
|
|
29722
29752
|
|
|
29723
29753
|
// src/schema/subscription_addons.ts
|
|
29724
|
-
import { pgTable as pgTable110, text as text111, varchar as varchar82, integer as integer56, timestamp as timestamp102, index as index96, uniqueIndex as
|
|
29754
|
+
import { pgTable as pgTable110, text as text111, varchar as varchar82, integer as integer56, timestamp as timestamp102, index as index96, uniqueIndex as uniqueIndex52 } from "drizzle-orm/pg-core";
|
|
29725
29755
|
import { sql as sql35 } from "drizzle-orm";
|
|
29726
29756
|
var subscriptionAddons = pgTable110(
|
|
29727
29757
|
"subscription_addons",
|
|
@@ -29742,12 +29772,12 @@ var subscriptionAddons = pgTable110(
|
|
|
29742
29772
|
},
|
|
29743
29773
|
(t) => [
|
|
29744
29774
|
index96("subscription_addons_workspace_idx").on(t.workspaceId),
|
|
29745
|
-
|
|
29775
|
+
uniqueIndex52("subscription_addons_dodo_idx").on(t.dodoSubscriptionId).where(sql35`${t.dodoSubscriptionId} IS NOT NULL`)
|
|
29746
29776
|
]
|
|
29747
29777
|
);
|
|
29748
29778
|
|
|
29749
29779
|
// src/schema/billing_alerts.ts
|
|
29750
|
-
import { pgTable as pgTable111, text as text112, varchar as varchar83, timestamp as timestamp103, index as index97, uniqueIndex as
|
|
29780
|
+
import { pgTable as pgTable111, text as text112, varchar as varchar83, timestamp as timestamp103, index as index97, uniqueIndex as uniqueIndex53 } from "drizzle-orm/pg-core";
|
|
29751
29781
|
var billingAlerts = pgTable111(
|
|
29752
29782
|
"billing_alerts",
|
|
29753
29783
|
{
|
|
@@ -29767,13 +29797,13 @@ var billingAlerts = pgTable111(
|
|
|
29767
29797
|
sentAt: timestamp103("sent_at", { withTimezone: true }).notNull().defaultNow()
|
|
29768
29798
|
},
|
|
29769
29799
|
(t) => [
|
|
29770
|
-
|
|
29800
|
+
uniqueIndex53("billing_alerts_dedupe_idx").on(t.dedupeKey),
|
|
29771
29801
|
index97("billing_alerts_workspace_idx").on(t.workspaceId, t.sentAt)
|
|
29772
29802
|
]
|
|
29773
29803
|
);
|
|
29774
29804
|
|
|
29775
29805
|
// src/schema/ai_credit_ledger.ts
|
|
29776
|
-
import { pgTable as pgTable112, text as text113, varchar as varchar84, integer as integer57, timestamp as timestamp104, index as index98, uniqueIndex as
|
|
29806
|
+
import { pgTable as pgTable112, text as text113, varchar as varchar84, integer as integer57, timestamp as timestamp104, index as index98, uniqueIndex as uniqueIndex54 } from "drizzle-orm/pg-core";
|
|
29777
29807
|
import { sql as sql36 } from "drizzle-orm";
|
|
29778
29808
|
var aiCreditLedger = pgTable112(
|
|
29779
29809
|
"ai_credit_ledger",
|
|
@@ -29793,7 +29823,7 @@ var aiCreditLedger = pgTable112(
|
|
|
29793
29823
|
},
|
|
29794
29824
|
(t) => [
|
|
29795
29825
|
index98("ai_credit_ledger_workspace_idx").on(t.workspaceId, t.createdAt),
|
|
29796
|
-
|
|
29826
|
+
uniqueIndex54("ai_credit_ledger_custom_agent_run_unique").on(t.note).where(sql36`${t.reason} = 'consume' AND ${t.note} LIKE 'custom-agent-run:%'`)
|
|
29797
29827
|
]
|
|
29798
29828
|
);
|
|
29799
29829
|
|
|
@@ -29804,7 +29834,7 @@ import {
|
|
|
29804
29834
|
varchar as varchar85,
|
|
29805
29835
|
timestamp as timestamp105,
|
|
29806
29836
|
boolean as boolean36,
|
|
29807
|
-
jsonb as
|
|
29837
|
+
jsonb as jsonb62,
|
|
29808
29838
|
index as index99
|
|
29809
29839
|
} from "drizzle-orm/pg-core";
|
|
29810
29840
|
var supportTickets = pgTable113(
|
|
@@ -29840,7 +29870,7 @@ var supportTickets = pgTable113(
|
|
|
29840
29870
|
// hence the partial unique index rather than a unique column.
|
|
29841
29871
|
plainThreadId: text114("plain_thread_id"),
|
|
29842
29872
|
// Files attached when the case was opened, before any message row exists.
|
|
29843
|
-
attachments:
|
|
29873
|
+
attachments: jsonb62("attachments").$type().notNull().default([]),
|
|
29844
29874
|
createdAt: timestamp105("created_at").notNull().defaultNow(),
|
|
29845
29875
|
updatedAt: timestamp105("updated_at").notNull().defaultNow()
|
|
29846
29876
|
},
|
|
@@ -29871,7 +29901,7 @@ var supportTicketMessages = pgTable113(
|
|
|
29871
29901
|
// channels whose mutation returns no entry id — replyToThread returns only an error
|
|
29872
29902
|
// slot, which is why the echo check keys on the actor and this is the backstop.
|
|
29873
29903
|
plainMessageId: text114("plain_message_id"),
|
|
29874
|
-
attachments:
|
|
29904
|
+
attachments: jsonb62("attachments").$type().notNull().default([]),
|
|
29875
29905
|
createdAt: timestamp105("created_at").notNull().defaultNow()
|
|
29876
29906
|
},
|
|
29877
29907
|
(table) => [
|
|
@@ -29884,7 +29914,7 @@ import {
|
|
|
29884
29914
|
pgTable as pgTable114,
|
|
29885
29915
|
text as text115,
|
|
29886
29916
|
varchar as varchar86,
|
|
29887
|
-
jsonb as
|
|
29917
|
+
jsonb as jsonb63,
|
|
29888
29918
|
timestamp as timestamp106,
|
|
29889
29919
|
index as index100
|
|
29890
29920
|
} from "drizzle-orm/pg-core";
|
|
@@ -29905,7 +29935,7 @@ var adminActionLogs = pgTable114(
|
|
|
29905
29935
|
// workspace | user | plan | ticket
|
|
29906
29936
|
targetId: text115("target_id"),
|
|
29907
29937
|
reason: text115("reason"),
|
|
29908
|
-
metadata:
|
|
29938
|
+
metadata: jsonb63("metadata").$type().notNull().default({}),
|
|
29909
29939
|
ipAddress: text115("ip_address"),
|
|
29910
29940
|
createdAt: timestamp106("created_at").notNull().defaultNow()
|
|
29911
29941
|
},
|
|
@@ -30002,7 +30032,7 @@ import {
|
|
|
30002
30032
|
varchar as varchar90,
|
|
30003
30033
|
timestamp as timestamp110,
|
|
30004
30034
|
index as index104,
|
|
30005
|
-
uniqueIndex as
|
|
30035
|
+
uniqueIndex as uniqueIndex55
|
|
30006
30036
|
} from "drizzle-orm/pg-core";
|
|
30007
30037
|
var ENV_VAR_SCOPES = ["production", "preview", "development"];
|
|
30008
30038
|
var projectEnvVars = pgTable118(
|
|
@@ -30025,7 +30055,7 @@ var projectEnvVars = pgTable118(
|
|
|
30025
30055
|
},
|
|
30026
30056
|
(table) => [
|
|
30027
30057
|
// One value per key per scope — the same key MAY exist in production and preview.
|
|
30028
|
-
|
|
30058
|
+
uniqueIndex55("project_env_vars_project_key_scope_idx").on(
|
|
30029
30059
|
table.projectId,
|
|
30030
30060
|
table.key,
|
|
30031
30061
|
table.scope
|
|
@@ -30035,7 +30065,7 @@ var projectEnvVars = pgTable118(
|
|
|
30035
30065
|
);
|
|
30036
30066
|
|
|
30037
30067
|
// src/schema/mcp_connections.ts
|
|
30038
|
-
import { pgTable as pgTable119, text as text120, varchar as varchar91, jsonb as
|
|
30068
|
+
import { pgTable as pgTable119, text as text120, varchar as varchar91, jsonb as jsonb64, timestamp as timestamp111, index as index105, uniqueIndex as uniqueIndex56 } from "drizzle-orm/pg-core";
|
|
30039
30069
|
import { sql as sql37 } from "drizzle-orm";
|
|
30040
30070
|
var mcpConnections = pgTable119(
|
|
30041
30071
|
"mcp_connections",
|
|
@@ -30070,14 +30100,14 @@ var mcpConnections = pgTable119(
|
|
|
30070
30100
|
oauthState: text120("oauth_state"),
|
|
30071
30101
|
pkceVerifierEnc: text120("pkce_verifier_enc"),
|
|
30072
30102
|
/** Discovery output: authorization server metadata, token endpoint, RFC 8707 resource. */
|
|
30073
|
-
authMetadata:
|
|
30103
|
+
authMetadata: jsonb64("auth_metadata").$type(),
|
|
30074
30104
|
scopes: text120("scopes").array().$type(),
|
|
30075
30105
|
/**
|
|
30076
30106
|
* Full descriptors (name, description, inputSchema, annotations) — NOT just names. The
|
|
30077
30107
|
* read-only boundary is decided from `annotations.readOnlyHint`, so the names alone would
|
|
30078
30108
|
* force a live listTools on the turn path to answer a governance question.
|
|
30079
30109
|
*/
|
|
30080
|
-
toolsCache:
|
|
30110
|
+
toolsCache: jsonb64("tools_cache").$type().notNull().default([]),
|
|
30081
30111
|
toolsCachedAt: timestamp111("tools_cached_at", { withTimezone: true }),
|
|
30082
30112
|
/**
|
|
30083
30113
|
* pending | ok | invalid | revoked. `pending` is the pre-consent row; `invalid` is set on a
|
|
@@ -30099,7 +30129,7 @@ var mcpConnections = pgTable119(
|
|
|
30099
30129
|
index105("mcp_connections_project_idx").on(t.projectId),
|
|
30100
30130
|
// Reconnecting a catalog provider UPDATEs rather than accumulating a second live credential.
|
|
30101
30131
|
// Custom connectors are excluded: a project may legitimately add many distinct MCP servers.
|
|
30102
|
-
|
|
30132
|
+
uniqueIndex56("mcp_connections_project_provider_unique").on(t.projectId, t.providerSlug).where(sql37`deleted_at IS NULL AND provider_slug <> 'custom'`)
|
|
30103
30133
|
]
|
|
30104
30134
|
);
|
|
30105
30135
|
|
|
@@ -30109,9 +30139,9 @@ import {
|
|
|
30109
30139
|
text as text121,
|
|
30110
30140
|
timestamp as timestamp112,
|
|
30111
30141
|
boolean as boolean38,
|
|
30112
|
-
jsonb as
|
|
30142
|
+
jsonb as jsonb65,
|
|
30113
30143
|
integer as integer59,
|
|
30114
|
-
uniqueIndex as
|
|
30144
|
+
uniqueIndex as uniqueIndex57
|
|
30115
30145
|
} from "drizzle-orm/pg-core";
|
|
30116
30146
|
var crmConnections = pgTable120(
|
|
30117
30147
|
"crm_connections",
|
|
@@ -30131,7 +30161,7 @@ var crmConnections = pgTable120(
|
|
|
30131
30161
|
updatedAt: timestamp112("updated_at").notNull().defaultNow()
|
|
30132
30162
|
},
|
|
30133
30163
|
(t) => [
|
|
30134
|
-
|
|
30164
|
+
uniqueIndex57("crm_connection_account_uq").on(
|
|
30135
30165
|
t.workspaceId,
|
|
30136
30166
|
t.provider,
|
|
30137
30167
|
t.accountId
|
|
@@ -30157,8 +30187,8 @@ var formIntegrationDeliveries = pgTable120(
|
|
|
30157
30187
|
integrationId: text121("integration_id").notNull(),
|
|
30158
30188
|
eventId: text121("event_id").notNull(),
|
|
30159
30189
|
submissionId: text121("submission_id").notNull(),
|
|
30160
|
-
snapshot:
|
|
30161
|
-
data:
|
|
30190
|
+
snapshot: jsonb65("snapshot").$type().notNull(),
|
|
30191
|
+
data: jsonb65("data").$type().notNull(),
|
|
30162
30192
|
status: text121("status").notNull().default("queued"),
|
|
30163
30193
|
attempts: integer59("attempts").notNull().default(0),
|
|
30164
30194
|
lastError: text121("last_error"),
|
|
@@ -30169,7 +30199,7 @@ var formIntegrationDeliveries = pgTable120(
|
|
|
30169
30199
|
updatedAt: timestamp112("updated_at").notNull().defaultNow()
|
|
30170
30200
|
},
|
|
30171
30201
|
(t) => [
|
|
30172
|
-
|
|
30202
|
+
uniqueIndex57("crm_delivery_event_uq").on(
|
|
30173
30203
|
t.workspaceId,
|
|
30174
30204
|
t.eventId,
|
|
30175
30205
|
t.integrationId
|
|
@@ -31009,6 +31039,7 @@ export {
|
|
|
31009
31039
|
publicWorkspaceBySlug,
|
|
31010
31040
|
publishDeliveries,
|
|
31011
31041
|
publishItems,
|
|
31042
|
+
publishValueOutcomes,
|
|
31012
31043
|
publishes,
|
|
31013
31044
|
qaReports,
|
|
31014
31045
|
queries,
|