@bettercms-ai/db 0.12.0 → 0.12.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 +3 -1
- package/dist/index.js +340 -337
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11654,18 +11654,18 @@ var require_common = __commonJS({
|
|
|
11654
11654
|
if (typeof args[0] !== "string") {
|
|
11655
11655
|
args.unshift("%O");
|
|
11656
11656
|
}
|
|
11657
|
-
let
|
|
11657
|
+
let index114 = 0;
|
|
11658
11658
|
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
11659
11659
|
if (match === "%%") {
|
|
11660
11660
|
return "%";
|
|
11661
11661
|
}
|
|
11662
|
-
|
|
11662
|
+
index114++;
|
|
11663
11663
|
const formatter = createDebug.formatters[format];
|
|
11664
11664
|
if (typeof formatter === "function") {
|
|
11665
|
-
const val = args[
|
|
11665
|
+
const val = args[index114];
|
|
11666
11666
|
match = formatter.call(self2, val);
|
|
11667
|
-
args.splice(
|
|
11668
|
-
|
|
11667
|
+
args.splice(index114, 1);
|
|
11668
|
+
index114--;
|
|
11669
11669
|
}
|
|
11670
11670
|
return match;
|
|
11671
11671
|
});
|
|
@@ -11901,15 +11901,15 @@ var require_browser = __commonJS({
|
|
|
11901
11901
|
}
|
|
11902
11902
|
const c = "color: " + this.color;
|
|
11903
11903
|
args.splice(1, 0, c, "color: inherit");
|
|
11904
|
-
let
|
|
11904
|
+
let index114 = 0;
|
|
11905
11905
|
let lastC = 0;
|
|
11906
11906
|
args[0].replace(/%[a-zA-Z%]/g, (match) => {
|
|
11907
11907
|
if (match === "%%") {
|
|
11908
11908
|
return;
|
|
11909
11909
|
}
|
|
11910
|
-
|
|
11910
|
+
index114++;
|
|
11911
11911
|
if (match === "%c") {
|
|
11912
|
-
lastC =
|
|
11912
|
+
lastC = index114;
|
|
11913
11913
|
}
|
|
11914
11914
|
});
|
|
11915
11915
|
args.splice(lastC, 0, c);
|
|
@@ -14470,10 +14470,10 @@ var require_axios = __commonJS({
|
|
|
14470
14470
|
value = stringifyWithDepthLimit(value, 1);
|
|
14471
14471
|
} else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
|
|
14472
14472
|
key = removeBrackets(key);
|
|
14473
|
-
arr.forEach(function each(el,
|
|
14473
|
+
arr.forEach(function each(el, index114) {
|
|
14474
14474
|
!(utils$1.isUndefined(el) || el === null) && formData.append(
|
|
14475
14475
|
// eslint-disable-next-line no-nested-ternary
|
|
14476
|
-
indexes === true ? renderKey([key],
|
|
14476
|
+
indexes === true ? renderKey([key], index114, dots) : indexes === null ? key : key + "[]",
|
|
14477
14477
|
convertValue(el)
|
|
14478
14478
|
);
|
|
14479
14479
|
});
|
|
@@ -14774,9 +14774,9 @@ var require_axios = __commonJS({
|
|
|
14774
14774
|
});
|
|
14775
14775
|
}
|
|
14776
14776
|
var MAX_DEPTH = DEFAULT_FORM_DATA_MAX_DEPTH;
|
|
14777
|
-
function throwIfDepthExceeded(
|
|
14778
|
-
if (
|
|
14779
|
-
throw new AxiosError("FormData field is too deeply nested (" +
|
|
14777
|
+
function throwIfDepthExceeded(index114) {
|
|
14778
|
+
if (index114 > MAX_DEPTH) {
|
|
14779
|
+
throw new AxiosError("FormData field is too deeply nested (" + index114 + " levels). Max depth: " + MAX_DEPTH, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
|
|
14780
14780
|
}
|
|
14781
14781
|
}
|
|
14782
14782
|
function parsePropPath(name) {
|
|
@@ -14802,12 +14802,12 @@ var require_axios = __commonJS({
|
|
|
14802
14802
|
return obj;
|
|
14803
14803
|
}
|
|
14804
14804
|
function formDataToJSON(formData) {
|
|
14805
|
-
function buildPath(path2, value, target,
|
|
14806
|
-
throwIfDepthExceeded(
|
|
14807
|
-
let name = path2[
|
|
14805
|
+
function buildPath(path2, value, target, index114) {
|
|
14806
|
+
throwIfDepthExceeded(index114);
|
|
14807
|
+
let name = path2[index114++];
|
|
14808
14808
|
if (name === "__proto__") return true;
|
|
14809
14809
|
const isNumericKey = Number.isFinite(+name);
|
|
14810
|
-
const isLast =
|
|
14810
|
+
const isLast = index114 >= path2.length;
|
|
14811
14811
|
name = !name && utils$1.isArray(target) ? target.length : name;
|
|
14812
14812
|
if (isLast) {
|
|
14813
14813
|
if (utils$1.hasOwnProp(target, name)) {
|
|
@@ -14820,7 +14820,7 @@ var require_axios = __commonJS({
|
|
|
14820
14820
|
if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
|
|
14821
14821
|
target[name] = [];
|
|
14822
14822
|
}
|
|
14823
|
-
const result = buildPath(path2, value, target[name],
|
|
14823
|
+
const result = buildPath(path2, value, target[name], index114);
|
|
14824
14824
|
if (result && utils$1.isArray(target[name])) {
|
|
14825
14825
|
target[name] = arrayToObject(target[name]);
|
|
14826
14826
|
}
|
|
@@ -18242,9 +18242,9 @@ var require_axios = __commonJS({
|
|
|
18242
18242
|
if (!this._listeners) {
|
|
18243
18243
|
return;
|
|
18244
18244
|
}
|
|
18245
|
-
const
|
|
18246
|
-
if (
|
|
18247
|
-
this._listeners.splice(
|
|
18245
|
+
const index114 = this._listeners.indexOf(listener);
|
|
18246
|
+
if (index114 !== -1) {
|
|
18247
|
+
this._listeners.splice(index114, 1);
|
|
18248
18248
|
}
|
|
18249
18249
|
}
|
|
18250
18250
|
toAbortSignal() {
|
|
@@ -25385,22 +25385,25 @@ var projectRepos = pgTable48("project_repos", {
|
|
|
25385
25385
|
});
|
|
25386
25386
|
|
|
25387
25387
|
// src/schema/github_installations.ts
|
|
25388
|
-
import { pgTable as pgTable49, text as text50, varchar as varchar33, bigint as bigint2 } from "drizzle-orm/pg-core";
|
|
25388
|
+
import { pgTable as pgTable49, text as text50, varchar as varchar33, bigint as bigint2, index as index44, uniqueIndex as uniqueIndex19 } from "drizzle-orm/pg-core";
|
|
25389
25389
|
var githubInstallations = pgTable49("github_installations", {
|
|
25390
25390
|
id: text50("id").primaryKey(),
|
|
25391
25391
|
workspaceId: text50("workspace_id").notNull(),
|
|
25392
25392
|
// FK → workspaces.id (RLS scope)
|
|
25393
|
-
installationId: bigint2("installation_id", { mode: "number" }).notNull()
|
|
25393
|
+
installationId: bigint2("installation_id", { mode: "number" }).notNull(),
|
|
25394
25394
|
accountLogin: varchar33("account_login", { length: 255 }).notNull(),
|
|
25395
25395
|
accountType: varchar33("account_type", { length: 50 }).notNull(),
|
|
25396
25396
|
// 'User' | 'Organization'
|
|
25397
25397
|
connectedBy: text50("connected_by"),
|
|
25398
25398
|
// FK → users(id), added in migration
|
|
25399
25399
|
...auditColumns
|
|
25400
|
-
})
|
|
25400
|
+
}, (t) => [
|
|
25401
|
+
uniqueIndex19("github_installations_workspace_installation_unique").on(t.workspaceId, t.installationId),
|
|
25402
|
+
index44("github_installations_installation_id_idx").on(t.installationId)
|
|
25403
|
+
]);
|
|
25401
25404
|
|
|
25402
25405
|
// src/schema/custom_domains.ts
|
|
25403
|
-
import { pgTable as pgTable50, text as text51, varchar as varchar34, boolean as boolean23, timestamp as timestamp46, index as
|
|
25406
|
+
import { pgTable as pgTable50, text as text51, varchar as varchar34, boolean as boolean23, timestamp as timestamp46, index as index45, uniqueIndex as uniqueIndex20, jsonb as jsonb26 } from "drizzle-orm/pg-core";
|
|
25404
25407
|
var customDomains = pgTable50(
|
|
25405
25408
|
"custom_domains",
|
|
25406
25409
|
{
|
|
@@ -25442,16 +25445,16 @@ var customDomains = pgTable50(
|
|
|
25442
25445
|
...auditColumns
|
|
25443
25446
|
},
|
|
25444
25447
|
(t) => [
|
|
25445
|
-
|
|
25446
|
-
|
|
25448
|
+
uniqueIndex20("custom_domains_hostname_unique").on(t.hostname),
|
|
25449
|
+
index45("custom_domains_project_idx").on(t.projectId),
|
|
25447
25450
|
// Mirrors the partial unique index from 0237. Drizzle cannot express the WHERE clause
|
|
25448
25451
|
// here, so the DB is the source of truth for the constraint; this is the read hint.
|
|
25449
|
-
|
|
25452
|
+
index45("custom_domains_primary_idx").on(t.projectId, t.isPrimary)
|
|
25450
25453
|
]
|
|
25451
25454
|
);
|
|
25452
25455
|
|
|
25453
25456
|
// src/schema/storage_configs.ts
|
|
25454
|
-
import { pgTable as pgTable51, text as text52, varchar as varchar35, boolean as boolean24, timestamp as timestamp47, uniqueIndex as
|
|
25457
|
+
import { pgTable as pgTable51, text as text52, varchar as varchar35, boolean as boolean24, timestamp as timestamp47, uniqueIndex as uniqueIndex21, index as index46 } from "drizzle-orm/pg-core";
|
|
25455
25458
|
import { sql as sql10 } from "drizzle-orm";
|
|
25456
25459
|
var storageConfigs = pgTable51(
|
|
25457
25460
|
"storage_configs",
|
|
@@ -25485,15 +25488,15 @@ var storageConfigs = pgTable51(
|
|
|
25485
25488
|
...softDeleteColumn
|
|
25486
25489
|
},
|
|
25487
25490
|
(t) => [
|
|
25488
|
-
|
|
25489
|
-
|
|
25491
|
+
index46("storage_configs_project_idx").on(t.projectId),
|
|
25492
|
+
index46("storage_configs_workspace_idx").on(t.workspaceId),
|
|
25490
25493
|
// At most one active config per project.
|
|
25491
|
-
|
|
25494
|
+
uniqueIndex21("storage_configs_active_project_unique").on(t.projectId).where(sql10`deleted_at IS NULL`)
|
|
25492
25495
|
]
|
|
25493
25496
|
);
|
|
25494
25497
|
|
|
25495
25498
|
// src/schema/deploy_targets.ts
|
|
25496
|
-
import { pgTable as pgTable52, text as text53, varchar as varchar36, boolean as boolean25, timestamp as timestamp48, index as
|
|
25499
|
+
import { pgTable as pgTable52, text as text53, varchar as varchar36, boolean as boolean25, timestamp as timestamp48, index as index47 } from "drizzle-orm/pg-core";
|
|
25497
25500
|
var deployTargets = pgTable52(
|
|
25498
25501
|
"deploy_targets",
|
|
25499
25502
|
{
|
|
@@ -25560,13 +25563,13 @@ var deployTargets = pgTable52(
|
|
|
25560
25563
|
...softDeleteColumn
|
|
25561
25564
|
},
|
|
25562
25565
|
(t) => [
|
|
25563
|
-
|
|
25564
|
-
|
|
25566
|
+
index47("deploy_targets_project_idx").on(t.projectId),
|
|
25567
|
+
index47("deploy_targets_workspace_idx").on(t.workspaceId)
|
|
25565
25568
|
]
|
|
25566
25569
|
);
|
|
25567
25570
|
|
|
25568
25571
|
// src/schema/publishes.ts
|
|
25569
|
-
import { pgTable as pgTable53, text as text54, varchar as varchar37, timestamp as timestamp49, index as
|
|
25572
|
+
import { pgTable as pgTable53, text as text54, varchar as varchar37, timestamp as timestamp49, index as index48, uniqueIndex as uniqueIndex22, jsonb as jsonb27 } from "drizzle-orm/pg-core";
|
|
25570
25573
|
var publishes = pgTable53(
|
|
25571
25574
|
"publishes",
|
|
25572
25575
|
{
|
|
@@ -25592,7 +25595,7 @@ var publishes = pgTable53(
|
|
|
25592
25595
|
createdAt: timestamp49("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
25593
25596
|
updatedAt: timestamp49("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
25594
25597
|
},
|
|
25595
|
-
(t) => [
|
|
25598
|
+
(t) => [index48("publishes_project_created_idx").on(t.projectId, t.createdAt)]
|
|
25596
25599
|
);
|
|
25597
25600
|
var publishItems = pgTable53(
|
|
25598
25601
|
"publish_items",
|
|
@@ -25611,7 +25614,7 @@ var publishItems = pgTable53(
|
|
|
25611
25614
|
name: varchar37("name", { length: 255 }),
|
|
25612
25615
|
createdAt: timestamp49("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
25613
25616
|
},
|
|
25614
|
-
(t) => [
|
|
25617
|
+
(t) => [index48("publish_items_publish_idx").on(t.publishId)]
|
|
25615
25618
|
);
|
|
25616
25619
|
var publishDeliveries = pgTable53(
|
|
25617
25620
|
"publish_deliveries",
|
|
@@ -25635,8 +25638,8 @@ var publishDeliveries = pgTable53(
|
|
|
25635
25638
|
updatedAt: timestamp49("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
25636
25639
|
},
|
|
25637
25640
|
(t) => [
|
|
25638
|
-
|
|
25639
|
-
|
|
25641
|
+
index48("publish_deliveries_publish_idx").on(t.publishId),
|
|
25642
|
+
index48("publish_deliveries_open_idx").on(t.projectId, t.host, t.status)
|
|
25640
25643
|
]
|
|
25641
25644
|
);
|
|
25642
25645
|
var publishValueOutcomes = pgTable53(
|
|
@@ -25659,13 +25662,13 @@ var publishValueOutcomes = pgTable53(
|
|
|
25659
25662
|
createdAt: timestamp49("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
25660
25663
|
},
|
|
25661
25664
|
(t) => [
|
|
25662
|
-
|
|
25663
|
-
|
|
25665
|
+
uniqueIndex22("publish_value_outcomes_value_idx").on(t.publishId, t.route, t.address),
|
|
25666
|
+
index48("publish_value_outcomes_route_idx").on(t.projectId, t.route)
|
|
25664
25667
|
]
|
|
25665
25668
|
);
|
|
25666
25669
|
|
|
25667
25670
|
// src/schema/hosting_connections.ts
|
|
25668
|
-
import { pgTable as pgTable54, text as text55, varchar as varchar38, timestamp as timestamp50, index as
|
|
25671
|
+
import { pgTable as pgTable54, text as text55, varchar as varchar38, timestamp as timestamp50, index as index49, uniqueIndex as uniqueIndex23 } from "drizzle-orm/pg-core";
|
|
25669
25672
|
import { sql as sql11 } from "drizzle-orm";
|
|
25670
25673
|
var hostingConnections = pgTable54(
|
|
25671
25674
|
"hosting_connections",
|
|
@@ -25702,14 +25705,14 @@ var hostingConnections = pgTable54(
|
|
|
25702
25705
|
...softDeleteColumn
|
|
25703
25706
|
},
|
|
25704
25707
|
(t) => [
|
|
25705
|
-
|
|
25708
|
+
index49("hosting_connections_workspace_idx").on(t.workspaceId),
|
|
25706
25709
|
// Reconnecting the same account UPDATEs rather than accumulating a second live credential.
|
|
25707
|
-
|
|
25710
|
+
uniqueIndex23("hosting_connections_account_unique").on(t.workspaceId, t.provider, t.accountId).where(sql11`deleted_at IS NULL`)
|
|
25708
25711
|
]
|
|
25709
25712
|
);
|
|
25710
25713
|
|
|
25711
25714
|
// src/schema/external_deployments.ts
|
|
25712
|
-
import { pgTable as pgTable55, text as text56, varchar as varchar39, integer as integer23, timestamp as timestamp51, index as
|
|
25715
|
+
import { pgTable as pgTable55, text as text56, varchar as varchar39, integer as integer23, timestamp as timestamp51, index as index50, uniqueIndex as uniqueIndex24 } from "drizzle-orm/pg-core";
|
|
25713
25716
|
import { sql as sql12 } from "drizzle-orm";
|
|
25714
25717
|
var externalDeployments = pgTable55(
|
|
25715
25718
|
"external_deployments",
|
|
@@ -25746,9 +25749,9 @@ var externalDeployments = pgTable55(
|
|
|
25746
25749
|
updatedAt: timestamp51("updated_at").notNull().defaultNow()
|
|
25747
25750
|
},
|
|
25748
25751
|
(t) => [
|
|
25749
|
-
|
|
25750
|
-
|
|
25751
|
-
|
|
25752
|
+
index50("external_deployments_claim_idx").on(t.state, t.createdAt).where(sql12`state IN ('queued', 'deploying')`),
|
|
25753
|
+
index50("external_deployments_workspace_idx").on(t.workspaceId),
|
|
25754
|
+
index50("external_deployments_project_idx").on(t.projectId, t.createdAt.desc()),
|
|
25752
25755
|
/**
|
|
25753
25756
|
* Coalescing, and the reason the stale reaper cannot duplicate work: a publish burst produces
|
|
25754
25757
|
* one in-flight row per (target, sha), and re-enqueuing an artifact already deploying is a
|
|
@@ -25756,12 +25759,12 @@ var externalDeployments = pgTable55(
|
|
|
25756
25759
|
* Git-mode rows have sha NULL and are therefore NOT covered — NULLs never conflict — which is
|
|
25757
25760
|
* correct: a git deploy carries no artifact identity, so two publishes are two real builds.
|
|
25758
25761
|
*/
|
|
25759
|
-
|
|
25762
|
+
uniqueIndex24("external_deployments_inflight_unique").on(t.targetId, t.sha).where(sql12`state IN ('queued', 'deploying')`)
|
|
25760
25763
|
]
|
|
25761
25764
|
);
|
|
25762
25765
|
|
|
25763
25766
|
// src/schema/page_types.ts
|
|
25764
|
-
import { pgTable as pgTable56, text as text57, varchar as varchar40, jsonb as jsonb28, index as
|
|
25767
|
+
import { pgTable as pgTable56, text as text57, varchar as varchar40, jsonb as jsonb28, index as index51, uniqueIndex as uniqueIndex25 } from "drizzle-orm/pg-core";
|
|
25765
25768
|
var pageTypes = pgTable56(
|
|
25766
25769
|
"page_types",
|
|
25767
25770
|
{
|
|
@@ -25779,14 +25782,14 @@ var pageTypes = pgTable56(
|
|
|
25779
25782
|
...softDeleteColumn
|
|
25780
25783
|
},
|
|
25781
25784
|
(t) => [
|
|
25782
|
-
|
|
25783
|
-
|
|
25784
|
-
|
|
25785
|
+
index51("page_types_project_idx").on(t.projectId),
|
|
25786
|
+
index51("page_types_workspace_idx").on(t.workspaceId),
|
|
25787
|
+
uniqueIndex25("page_types_project_slug_unique").on(t.projectId, t.branchId, t.slug)
|
|
25785
25788
|
]
|
|
25786
25789
|
);
|
|
25787
25790
|
|
|
25788
25791
|
// src/schema/build_triggers.ts
|
|
25789
|
-
import { pgTable as pgTable57, text as text58, varchar as varchar41, boolean as boolean26, timestamp as timestamp53, integer as integer24, jsonb as jsonb29, index as
|
|
25792
|
+
import { pgTable as pgTable57, text as text58, varchar as varchar41, boolean as boolean26, timestamp as timestamp53, integer as integer24, jsonb as jsonb29, index as index52, uniqueIndex as uniqueIndex26 } from "drizzle-orm/pg-core";
|
|
25790
25793
|
var BUILD_TRIGGER_KINDS = ["webhook", "content", "schedule"];
|
|
25791
25794
|
var buildTriggers = pgTable57(
|
|
25792
25795
|
"build_triggers",
|
|
@@ -25819,9 +25822,9 @@ var buildTriggers = pgTable57(
|
|
|
25819
25822
|
...softDeleteColumn
|
|
25820
25823
|
},
|
|
25821
25824
|
(t) => [
|
|
25822
|
-
|
|
25823
|
-
|
|
25824
|
-
|
|
25825
|
+
index52("build_triggers_project_idx").on(t.projectId),
|
|
25826
|
+
index52("build_triggers_workspace_idx").on(t.workspaceId),
|
|
25827
|
+
uniqueIndex26("build_triggers_project_name_unique").on(t.projectId, t.name)
|
|
25825
25828
|
]
|
|
25826
25829
|
);
|
|
25827
25830
|
var buildTriggerRuns = pgTable57(
|
|
@@ -25851,8 +25854,8 @@ var buildTriggerRuns = pgTable57(
|
|
|
25851
25854
|
createdAt: timestamp53("created_at").notNull().defaultNow()
|
|
25852
25855
|
},
|
|
25853
25856
|
(t) => [
|
|
25854
|
-
|
|
25855
|
-
|
|
25857
|
+
index52("build_trigger_runs_trigger_idx").on(t.triggerId, t.firedAt),
|
|
25858
|
+
index52("build_trigger_runs_workspace_idx").on(t.workspaceId)
|
|
25856
25859
|
]
|
|
25857
25860
|
);
|
|
25858
25861
|
|
|
@@ -25884,7 +25887,7 @@ var generatedTypes = pgTable59("generated_types", {
|
|
|
25884
25887
|
});
|
|
25885
25888
|
|
|
25886
25889
|
// src/schema/agent_keys.ts
|
|
25887
|
-
import { pgTable as pgTable60, text as text61, uniqueIndex as
|
|
25890
|
+
import { pgTable as pgTable60, text as text61, uniqueIndex as uniqueIndex27 } from "drizzle-orm/pg-core";
|
|
25888
25891
|
var agentKeys = pgTable60(
|
|
25889
25892
|
"agent_keys",
|
|
25890
25893
|
{
|
|
@@ -25896,11 +25899,11 @@ var agentKeys = pgTable60(
|
|
|
25896
25899
|
// AES-256-GCM encrypted
|
|
25897
25900
|
...auditColumns
|
|
25898
25901
|
},
|
|
25899
|
-
(t) => [
|
|
25902
|
+
(t) => [uniqueIndex27("agent_keys_workspace_unique").on(t.workspaceId)]
|
|
25900
25903
|
);
|
|
25901
25904
|
|
|
25902
25905
|
// src/schema/ai_provider_keys.ts
|
|
25903
|
-
import { pgTable as pgTable61, text as text62, varchar as varchar44, uniqueIndex as
|
|
25906
|
+
import { pgTable as pgTable61, text as text62, varchar as varchar44, uniqueIndex as uniqueIndex28 } from "drizzle-orm/pg-core";
|
|
25904
25907
|
var aiProviderKeys = pgTable61(
|
|
25905
25908
|
"ai_provider_keys",
|
|
25906
25909
|
{
|
|
@@ -25914,11 +25917,11 @@ var aiProviderKeys = pgTable61(
|
|
|
25914
25917
|
keyHint: varchar44("key_hint", { length: 8 }).notNull(),
|
|
25915
25918
|
...auditColumns
|
|
25916
25919
|
},
|
|
25917
|
-
(t) => [
|
|
25920
|
+
(t) => [uniqueIndex28("ai_provider_keys_workspace_provider_key").on(t.workspaceId, t.provider)]
|
|
25918
25921
|
);
|
|
25919
25922
|
|
|
25920
25923
|
// src/schema/agent_sessions.ts
|
|
25921
|
-
import { pgTable as pgTable62, text as text63, varchar as varchar45, timestamp as timestamp56, doublePrecision, jsonb as jsonb30, index as
|
|
25924
|
+
import { pgTable as pgTable62, text as text63, varchar as varchar45, timestamp as timestamp56, doublePrecision, jsonb as jsonb30, index as index53 } from "drizzle-orm/pg-core";
|
|
25922
25925
|
var agentSessions = pgTable62(
|
|
25923
25926
|
"agent_sessions",
|
|
25924
25927
|
{
|
|
@@ -25950,8 +25953,8 @@ var agentSessions = pgTable62(
|
|
|
25950
25953
|
lastActiveAt: timestamp56("last_active_at").notNull().defaultNow()
|
|
25951
25954
|
},
|
|
25952
25955
|
(t) => [
|
|
25953
|
-
|
|
25954
|
-
|
|
25956
|
+
index53("agent_sessions_project_idx").on(t.projectId, t.lastActiveAt),
|
|
25957
|
+
index53("agent_sessions_project_surface_idx").on(t.projectId, t.surface, t.lastActiveAt)
|
|
25955
25958
|
]
|
|
25956
25959
|
);
|
|
25957
25960
|
var agentMessages = pgTable62(
|
|
@@ -25966,11 +25969,11 @@ var agentMessages = pgTable62(
|
|
|
25966
25969
|
// { text? , toolName?, toolInput?, toolResult? ... }
|
|
25967
25970
|
createdAt: timestamp56("created_at").notNull().defaultNow()
|
|
25968
25971
|
},
|
|
25969
|
-
(t) => [
|
|
25972
|
+
(t) => [index53("agent_messages_session_idx").on(t.sessionId, t.createdAt)]
|
|
25970
25973
|
);
|
|
25971
25974
|
|
|
25972
25975
|
// src/schema/agent_instructions.ts
|
|
25973
|
-
import { pgTable as pgTable63, text as text64, varchar as varchar46, boolean as boolean27, jsonb as jsonb31, timestamp as timestamp57, index as
|
|
25976
|
+
import { pgTable as pgTable63, text as text64, varchar as varchar46, boolean as boolean27, jsonb as jsonb31, timestamp as timestamp57, index as index54, check as check2 } from "drizzle-orm/pg-core";
|
|
25974
25977
|
import { sql as sql13 } from "drizzle-orm";
|
|
25975
25978
|
var INSTRUCTION_KINDS = ["skill", "rule"];
|
|
25976
25979
|
var INSTRUCTION_SOURCES = ["template", "manual", "import"];
|
|
@@ -26000,7 +26003,7 @@ var agentInstructions = pgTable63(
|
|
|
26000
26003
|
updatedAt: timestamp57("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
26001
26004
|
},
|
|
26002
26005
|
(table) => [
|
|
26003
|
-
|
|
26006
|
+
index54("agent_instructions_workspace_idx").on(table.workspaceId),
|
|
26004
26007
|
// The SAME three constraints migration 0167 declares, mirrored here so DEV and PROD converge.
|
|
26005
26008
|
// Without them dev silently loses all three: drizzle-kit push runs FIRST (compose.yaml) and
|
|
26006
26009
|
// creates the table from THIS file, after which 0167's `CREATE TABLE IF NOT EXISTS` no-ops —
|
|
@@ -26016,13 +26019,13 @@ var agentInstructions = pgTable63(
|
|
|
26016
26019
|
import {
|
|
26017
26020
|
boolean as boolean28,
|
|
26018
26021
|
check as check3,
|
|
26019
|
-
index as
|
|
26022
|
+
index as index55,
|
|
26020
26023
|
integer as integer26,
|
|
26021
26024
|
jsonb as jsonb32,
|
|
26022
26025
|
pgTable as pgTable64,
|
|
26023
26026
|
text as text65,
|
|
26024
26027
|
timestamp as timestamp58,
|
|
26025
|
-
uniqueIndex as
|
|
26028
|
+
uniqueIndex as uniqueIndex29,
|
|
26026
26029
|
varchar as varchar47
|
|
26027
26030
|
} from "drizzle-orm/pg-core";
|
|
26028
26031
|
import { sql as sql14 } from "drizzle-orm";
|
|
@@ -26054,9 +26057,9 @@ var customAgents = pgTable64(
|
|
|
26054
26057
|
archivedAt: timestamp58("archived_at", { withTimezone: true })
|
|
26055
26058
|
},
|
|
26056
26059
|
(table) => [
|
|
26057
|
-
|
|
26058
|
-
|
|
26059
|
-
|
|
26060
|
+
uniqueIndex29("custom_agents_workspace_slug_unique").on(table.workspaceId, table.slug),
|
|
26061
|
+
index55("custom_agents_workspace_status_idx").on(table.workspaceId, table.status, table.updatedAt),
|
|
26062
|
+
index55("custom_agents_project_status_idx").on(table.projectId, table.status, table.updatedAt),
|
|
26060
26063
|
check3("custom_agents_status_check", sql14`${table.status} IN ('active', 'archived')`),
|
|
26061
26064
|
check3("custom_agents_version_check", sql14`${table.optimisticVersion} > 0`),
|
|
26062
26065
|
check3(
|
|
@@ -26082,8 +26085,8 @@ var customAgentRevisions = pgTable64(
|
|
|
26082
26085
|
createdAt: timestamp58("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
26083
26086
|
},
|
|
26084
26087
|
(table) => [
|
|
26085
|
-
|
|
26086
|
-
|
|
26088
|
+
uniqueIndex29("custom_agent_revisions_agent_version_unique").on(table.agentId, table.version),
|
|
26089
|
+
index55("custom_agent_revisions_workspace_agent_idx").on(table.workspaceId, table.agentId),
|
|
26087
26090
|
check3("custom_agent_revisions_version_check", sql14`${table.version} > 0`),
|
|
26088
26091
|
check3("custom_agent_revisions_speed_check", sql14`${table.speed} IN ('lite', 'balanced', 'max')`),
|
|
26089
26092
|
check3("custom_agent_revisions_review_check", sql14`${table.reviewPolicy} = 'draft_only'`),
|
|
@@ -26121,10 +26124,10 @@ var customAgentRuns = pgTable64(
|
|
|
26121
26124
|
updatedAt: timestamp58("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
26122
26125
|
},
|
|
26123
26126
|
(table) => [
|
|
26124
|
-
|
|
26125
|
-
|
|
26126
|
-
|
|
26127
|
-
|
|
26127
|
+
uniqueIndex29("custom_agent_runs_agent_idempotency_unique").on(table.agentId, table.idempotencyKey),
|
|
26128
|
+
index55("custom_agent_runs_agent_created_idx").on(table.agentId, table.createdAt),
|
|
26129
|
+
index55("custom_agent_runs_workspace_status_idx").on(table.workspaceId, table.status, table.createdAt),
|
|
26130
|
+
index55("custom_agent_runs_project_status_idx").on(table.projectId, table.status, table.createdAt),
|
|
26128
26131
|
check3("custom_agent_runs_trigger_check", sql14`${table.trigger} = 'manual'`),
|
|
26129
26132
|
check3("custom_agent_runs_speed_check", sql14`${table.effectiveSpeed} IN ('lite', 'balanced', 'max')`),
|
|
26130
26133
|
check3(
|
|
@@ -26136,7 +26139,7 @@ var customAgentRuns = pgTable64(
|
|
|
26136
26139
|
);
|
|
26137
26140
|
|
|
26138
26141
|
// src/schema/ai_generation_jobs.ts
|
|
26139
|
-
import { pgTable as pgTable65, text as text66, varchar as varchar48, integer as integer27, jsonb as jsonb33, timestamp as timestamp59, index as
|
|
26142
|
+
import { pgTable as pgTable65, text as text66, varchar as varchar48, integer as integer27, jsonb as jsonb33, timestamp as timestamp59, index as index56 } from "drizzle-orm/pg-core";
|
|
26140
26143
|
var aiGenerationJobs = pgTable65(
|
|
26141
26144
|
"ai_generation_jobs",
|
|
26142
26145
|
{
|
|
@@ -26208,7 +26211,7 @@ var aiGenerationJobs = pgTable65(
|
|
|
26208
26211
|
createdAt: timestamp59("created_at").notNull().defaultNow(),
|
|
26209
26212
|
updatedAt: timestamp59("updated_at").notNull().defaultNow()
|
|
26210
26213
|
},
|
|
26211
|
-
(t) => [
|
|
26214
|
+
(t) => [index56("ai_generation_jobs_status_idx").on(t.status, t.createdAt)]
|
|
26212
26215
|
);
|
|
26213
26216
|
|
|
26214
26217
|
// src/schema/preview_token_revocations.ts
|
|
@@ -26222,7 +26225,7 @@ var previewTokenRevocations = pgTable66("preview_token_revocations", {
|
|
|
26222
26225
|
});
|
|
26223
26226
|
|
|
26224
26227
|
// src/schema/abm_campaigns.ts
|
|
26225
|
-
import { index as
|
|
26228
|
+
import { index as index57, integer as integer28, jsonb as jsonb34, pgTable as pgTable67, text as text68, timestamp as timestamp61, varchar as varchar49 } from "drizzle-orm/pg-core";
|
|
26226
26229
|
var abmCampaigns = pgTable67(
|
|
26227
26230
|
"abm_campaigns",
|
|
26228
26231
|
{
|
|
@@ -26245,11 +26248,11 @@ var abmCampaigns = pgTable67(
|
|
|
26245
26248
|
createdAt: timestamp61("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
26246
26249
|
updatedAt: timestamp61("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
26247
26250
|
},
|
|
26248
|
-
(table) => [
|
|
26251
|
+
(table) => [index57("abm_campaigns_project_status_idx").on(table.projectId, table.status)]
|
|
26249
26252
|
);
|
|
26250
26253
|
|
|
26251
26254
|
// src/schema/abm_share_tokens.ts
|
|
26252
|
-
import { index as
|
|
26255
|
+
import { index as index58, integer as integer29, pgTable as pgTable68, text as text69, timestamp as timestamp62, varchar as varchar50 } from "drizzle-orm/pg-core";
|
|
26253
26256
|
var abmShareTokens = pgTable68(
|
|
26254
26257
|
"abm_share_tokens",
|
|
26255
26258
|
{
|
|
@@ -26269,11 +26272,11 @@ var abmShareTokens = pgTable68(
|
|
|
26269
26272
|
/** The whole of the rep-facing Not sent / Sent / Visited status, at zero analytics cost. */
|
|
26270
26273
|
uses: integer29("uses").notNull().default(0)
|
|
26271
26274
|
},
|
|
26272
|
-
(table) => [
|
|
26275
|
+
(table) => [index58("abm_share_tokens_campaign_idx").on(table.campaignId)]
|
|
26273
26276
|
);
|
|
26274
26277
|
|
|
26275
26278
|
// src/schema/mcp_tasks.ts
|
|
26276
|
-
import { check as check4, index as
|
|
26279
|
+
import { check as check4, index as index59, integer as integer30, jsonb as jsonb35, pgTable as pgTable69, text as text70, timestamp as timestamp63, uniqueIndex as uniqueIndex30, varchar as varchar51 } from "drizzle-orm/pg-core";
|
|
26277
26280
|
import { sql as sql15 } from "drizzle-orm";
|
|
26278
26281
|
var MCP_TASK_STATUSES = [
|
|
26279
26282
|
"working",
|
|
@@ -26304,15 +26307,15 @@ var mcpTasks = pgTable69(
|
|
|
26304
26307
|
updatedAt: timestamp63("updated_at").notNull().defaultNow()
|
|
26305
26308
|
},
|
|
26306
26309
|
(table) => [
|
|
26307
|
-
|
|
26308
|
-
|
|
26310
|
+
uniqueIndex30("mcp_tasks_ai_job_uidx").on(table.aiJobId).where(sql15`${table.aiJobId} IS NOT NULL`),
|
|
26311
|
+
index59("mcp_tasks_principal_idx").on(
|
|
26309
26312
|
table.workspaceId,
|
|
26310
26313
|
table.projectId,
|
|
26311
26314
|
table.principalKind,
|
|
26312
26315
|
table.principalId,
|
|
26313
26316
|
table.createdAt
|
|
26314
26317
|
),
|
|
26315
|
-
|
|
26318
|
+
index59("mcp_tasks_status_idx").on(table.workspaceId, table.status, table.updatedAt),
|
|
26316
26319
|
check4("mcp_tasks_status_check", sql15`${table.status} IN ('working','input_required','completed','failed','cancelled')`),
|
|
26317
26320
|
check4("mcp_tasks_principal_kind_check", sql15`${table.principalKind} IN ('api_key','device')`),
|
|
26318
26321
|
check4("mcp_tasks_ai_job_handle_check", sql15`${table.aiJobId} IS NULL OR ${table.aiJobId} = ${table.id}`),
|
|
@@ -26335,7 +26338,7 @@ var mcpTasks = pgTable69(
|
|
|
26335
26338
|
);
|
|
26336
26339
|
|
|
26337
26340
|
// src/schema/seo_reports.ts
|
|
26338
|
-
import { pgTable as pgTable70, text as text71, date, jsonb as jsonb36, timestamp as timestamp64, uniqueIndex as
|
|
26341
|
+
import { pgTable as pgTable70, text as text71, date, jsonb as jsonb36, timestamp as timestamp64, uniqueIndex as uniqueIndex31, index as index60 } from "drizzle-orm/pg-core";
|
|
26339
26342
|
var seoReports = pgTable70(
|
|
26340
26343
|
"seo_reports",
|
|
26341
26344
|
{
|
|
@@ -26351,13 +26354,13 @@ var seoReports = pgTable70(
|
|
|
26351
26354
|
},
|
|
26352
26355
|
(t) => [
|
|
26353
26356
|
// Idempotency guard: one report per period (matches the per-minute cron).
|
|
26354
|
-
|
|
26355
|
-
|
|
26357
|
+
uniqueIndex31("seo_reports_project_period_idx").on(t.projectId, t.periodStart, t.periodEnd),
|
|
26358
|
+
index60("seo_reports_project_created_idx").on(t.projectId, t.createdAt)
|
|
26356
26359
|
]
|
|
26357
26360
|
);
|
|
26358
26361
|
|
|
26359
26362
|
// src/schema/qa_reports.ts
|
|
26360
|
-
import { pgTable as pgTable71, text as text72, integer as integer31, jsonb as jsonb37, timestamp as timestamp65, index as
|
|
26363
|
+
import { pgTable as pgTable71, text as text72, integer as integer31, jsonb as jsonb37, timestamp as timestamp65, index as index61 } from "drizzle-orm/pg-core";
|
|
26361
26364
|
var qaReports = pgTable71(
|
|
26362
26365
|
"qa_reports",
|
|
26363
26366
|
{
|
|
@@ -26370,11 +26373,11 @@ var qaReports = pgTable71(
|
|
|
26370
26373
|
criticalCount: integer31("critical_count").notNull().default(0),
|
|
26371
26374
|
createdAt: timestamp65("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
26372
26375
|
},
|
|
26373
|
-
(t) => [
|
|
26376
|
+
(t) => [index61("qa_reports_project_created_idx").on(t.projectId, t.createdAt)]
|
|
26374
26377
|
);
|
|
26375
26378
|
|
|
26376
26379
|
// src/schema/webflow_integrations.ts
|
|
26377
|
-
import { pgTable as pgTable72, text as text73, varchar as varchar52, jsonb as jsonb38, timestamp as timestamp66, index as
|
|
26380
|
+
import { pgTable as pgTable72, text as text73, varchar as varchar52, jsonb as jsonb38, timestamp as timestamp66, index as index62 } from "drizzle-orm/pg-core";
|
|
26378
26381
|
var webflowIntegrations = pgTable72(
|
|
26379
26382
|
"webflow_integrations",
|
|
26380
26383
|
{
|
|
@@ -26394,11 +26397,11 @@ var webflowIntegrations = pgTable72(
|
|
|
26394
26397
|
createdAt: timestamp66("created_at").notNull().defaultNow(),
|
|
26395
26398
|
updatedAt: timestamp66("updated_at").notNull().defaultNow()
|
|
26396
26399
|
},
|
|
26397
|
-
(t) => [
|
|
26400
|
+
(t) => [index62("webflow_integrations_workspace_idx").on(t.workspaceId)]
|
|
26398
26401
|
);
|
|
26399
26402
|
|
|
26400
26403
|
// src/schema/migration_jobs.ts
|
|
26401
|
-
import { pgTable as pgTable73, text as text74, varchar as varchar53, integer as integer32, jsonb as jsonb39, timestamp as timestamp67, index as
|
|
26404
|
+
import { pgTable as pgTable73, text as text74, varchar as varchar53, integer as integer32, jsonb as jsonb39, timestamp as timestamp67, index as index63 } from "drizzle-orm/pg-core";
|
|
26402
26405
|
var migrationJobs = pgTable73(
|
|
26403
26406
|
"migration_jobs",
|
|
26404
26407
|
{
|
|
@@ -26429,13 +26432,13 @@ var migrationJobs = pgTable73(
|
|
|
26429
26432
|
updatedAt: timestamp67("updated_at").notNull().defaultNow()
|
|
26430
26433
|
},
|
|
26431
26434
|
(t) => [
|
|
26432
|
-
|
|
26433
|
-
|
|
26435
|
+
index63("migration_jobs_status_idx").on(t.status, t.createdAt),
|
|
26436
|
+
index63("migration_jobs_project_idx").on(t.projectId, t.createdAt)
|
|
26434
26437
|
]
|
|
26435
26438
|
);
|
|
26436
26439
|
|
|
26437
26440
|
// src/schema/ai_reports.ts
|
|
26438
|
-
import { pgTable as pgTable74, text as text75, varchar as varchar54, jsonb as jsonb40, timestamp as timestamp68, index as
|
|
26441
|
+
import { pgTable as pgTable74, text as text75, varchar as varchar54, jsonb as jsonb40, timestamp as timestamp68, index as index64 } from "drizzle-orm/pg-core";
|
|
26439
26442
|
var aiReports = pgTable74(
|
|
26440
26443
|
"ai_reports",
|
|
26441
26444
|
{
|
|
@@ -26448,7 +26451,7 @@ var aiReports = pgTable74(
|
|
|
26448
26451
|
summary: text75("summary").notNull(),
|
|
26449
26452
|
createdAt: timestamp68("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
26450
26453
|
},
|
|
26451
|
-
(t) => [
|
|
26454
|
+
(t) => [index64("ai_reports_project_kind_created_idx").on(t.projectId, t.kind, t.createdAt)]
|
|
26452
26455
|
);
|
|
26453
26456
|
|
|
26454
26457
|
// src/schema/analytics.ts
|
|
@@ -26461,8 +26464,8 @@ import {
|
|
|
26461
26464
|
integer as integer33,
|
|
26462
26465
|
bigint as bigint3,
|
|
26463
26466
|
smallint,
|
|
26464
|
-
index as
|
|
26465
|
-
uniqueIndex as
|
|
26467
|
+
index as index65,
|
|
26468
|
+
uniqueIndex as uniqueIndex32,
|
|
26466
26469
|
primaryKey as primaryKey5
|
|
26467
26470
|
} from "drizzle-orm/pg-core";
|
|
26468
26471
|
import { sql as sql16 } from "drizzle-orm";
|
|
@@ -26497,10 +26500,10 @@ var analyticsEventsRaw = pgTable75(
|
|
|
26497
26500
|
weight: smallint("weight").notNull().default(1)
|
|
26498
26501
|
},
|
|
26499
26502
|
(t) => [
|
|
26500
|
-
|
|
26501
|
-
|
|
26503
|
+
index65("analytics_events_raw_project_ts_idx").on(t.projectId, t.ts),
|
|
26504
|
+
index65("analytics_events_raw_ts_idx").on(t.ts),
|
|
26502
26505
|
// Partial, so the nginx path (event_id NULL) is unconstrained and unchanged.
|
|
26503
|
-
|
|
26506
|
+
uniqueIndex32("analytics_events_raw_event_id_uidx").on(t.eventId).where(sql16`${t.eventId} IS NOT NULL`)
|
|
26504
26507
|
]
|
|
26505
26508
|
);
|
|
26506
26509
|
var analyticsDailyTotals = pgTable75(
|
|
@@ -26526,7 +26529,7 @@ var analyticsDailyTotals = pgTable75(
|
|
|
26526
26529
|
},
|
|
26527
26530
|
(t) => [
|
|
26528
26531
|
primaryKey5({ columns: [t.projectId, t.day] }),
|
|
26529
|
-
|
|
26532
|
+
index65("analytics_daily_totals_ws_day_idx").on(t.workspaceId, t.day)
|
|
26530
26533
|
]
|
|
26531
26534
|
);
|
|
26532
26535
|
var analyticsDailyPages = pgTable75(
|
|
@@ -26566,7 +26569,7 @@ var analyticsDailyBreakdown = pgTable75(
|
|
|
26566
26569
|
},
|
|
26567
26570
|
(t) => [
|
|
26568
26571
|
primaryKey5({ columns: [t.projectId, t.day, t.dim, t.key] }),
|
|
26569
|
-
|
|
26572
|
+
index65("analytics_daily_breakdown_ws_day_dim_idx").on(t.workspaceId, t.day, t.dim)
|
|
26570
26573
|
]
|
|
26571
26574
|
);
|
|
26572
26575
|
var analyticsCursor = pgTable75("analytics_cursor", {
|
|
@@ -26577,7 +26580,7 @@ var analyticsCursor = pgTable75("analytics_cursor", {
|
|
|
26577
26580
|
});
|
|
26578
26581
|
|
|
26579
26582
|
// src/schema/site_files.ts
|
|
26580
|
-
import { pgTable as pgTable76, text as text77, varchar as varchar56, integer as integer34, timestamp as timestamp70, uniqueIndex as
|
|
26583
|
+
import { pgTable as pgTable76, text as text77, varchar as varchar56, integer as integer34, timestamp as timestamp70, uniqueIndex as uniqueIndex33 } from "drizzle-orm/pg-core";
|
|
26581
26584
|
var SITE_FILE_KINDS = ["llms.txt", "llms-full.txt"];
|
|
26582
26585
|
var siteFiles = pgTable76(
|
|
26583
26586
|
"site_files",
|
|
@@ -26595,11 +26598,11 @@ var siteFiles = pgTable76(
|
|
|
26595
26598
|
createdAt: timestamp70("created_at").notNull().defaultNow(),
|
|
26596
26599
|
updatedAt: timestamp70("updated_at").notNull().defaultNow()
|
|
26597
26600
|
},
|
|
26598
|
-
(t) => [
|
|
26601
|
+
(t) => [uniqueIndex33("site_files_project_kind_idx").on(t.projectId, t.kind)]
|
|
26599
26602
|
);
|
|
26600
26603
|
|
|
26601
26604
|
// src/schema/indexnow_submissions.ts
|
|
26602
|
-
import { pgTable as pgTable77, text as text78, varchar as varchar57, integer as integer35, jsonb as jsonb41, timestamp as timestamp71, index as
|
|
26605
|
+
import { pgTable as pgTable77, text as text78, varchar as varchar57, integer as integer35, jsonb as jsonb41, timestamp as timestamp71, index as index66 } from "drizzle-orm/pg-core";
|
|
26603
26606
|
var INDEXNOW_KINDS = ["auto", "manual", "retry"];
|
|
26604
26607
|
var INDEXNOW_STATUSES = ["ok", "failed"];
|
|
26605
26608
|
var indexnowSubmissions = pgTable77(
|
|
@@ -26621,11 +26624,11 @@ var indexnowSubmissions = pgTable77(
|
|
|
26621
26624
|
kind: varchar57("kind", { length: 8 }).$type().notNull().default("auto"),
|
|
26622
26625
|
createdAt: timestamp71("created_at").notNull().defaultNow()
|
|
26623
26626
|
},
|
|
26624
|
-
(t) => [
|
|
26627
|
+
(t) => [index66("indexnow_submissions_project_created_idx").on(t.projectId, t.createdAt)]
|
|
26625
26628
|
);
|
|
26626
26629
|
|
|
26627
26630
|
// src/schema/brand_kit_versions.ts
|
|
26628
|
-
import { pgTable as pgTable78, text as text79, integer as integer36, jsonb as jsonb42, timestamp as timestamp72, primaryKey as primaryKey6, index as
|
|
26631
|
+
import { pgTable as pgTable78, text as text79, integer as integer36, jsonb as jsonb42, timestamp as timestamp72, primaryKey as primaryKey6, index as index67 } from "drizzle-orm/pg-core";
|
|
26629
26632
|
var brandKitVersions = pgTable78(
|
|
26630
26633
|
"brand_kit_versions",
|
|
26631
26634
|
{
|
|
@@ -26643,12 +26646,12 @@ var brandKitVersions = pgTable78(
|
|
|
26643
26646
|
},
|
|
26644
26647
|
(t) => [
|
|
26645
26648
|
primaryKey6({ columns: [t.projectId, t.version, t.id] }),
|
|
26646
|
-
|
|
26649
|
+
index67("brand_kit_versions_project_created_idx").on(t.projectId, t.version)
|
|
26647
26650
|
]
|
|
26648
26651
|
);
|
|
26649
26652
|
|
|
26650
26653
|
// src/schema/webhook_deliveries.ts
|
|
26651
|
-
import { pgTable as pgTable79, text as text80, varchar as varchar58, integer as integer37, boolean as boolean29, timestamp as timestamp73, index as
|
|
26654
|
+
import { pgTable as pgTable79, text as text80, varchar as varchar58, integer as integer37, boolean as boolean29, timestamp as timestamp73, index as index68 } from "drizzle-orm/pg-core";
|
|
26652
26655
|
var webhookDeliveries = pgTable79(
|
|
26653
26656
|
"webhook_deliveries",
|
|
26654
26657
|
{
|
|
@@ -26675,11 +26678,11 @@ var webhookDeliveries = pgTable79(
|
|
|
26675
26678
|
isTest: boolean29("is_test").notNull().default(false),
|
|
26676
26679
|
attemptedAt: timestamp73("attempted_at").notNull().defaultNow()
|
|
26677
26680
|
},
|
|
26678
|
-
(t) => [
|
|
26681
|
+
(t) => [index68("webhook_deliveries_webhook_attempted_idx").on(t.webhookId, t.attemptedAt)]
|
|
26679
26682
|
);
|
|
26680
26683
|
|
|
26681
26684
|
// src/schema/markdown_files.ts
|
|
26682
|
-
import { pgTable as pgTable80, text as text81, varchar as varchar59, timestamp as timestamp74, uniqueIndex as
|
|
26685
|
+
import { pgTable as pgTable80, text as text81, varchar as varchar59, timestamp as timestamp74, uniqueIndex as uniqueIndex34 } from "drizzle-orm/pg-core";
|
|
26683
26686
|
var MARKDOWN_FILE_STATUSES = ["draft", "published"];
|
|
26684
26687
|
var markdownFiles = pgTable80(
|
|
26685
26688
|
"markdown_files",
|
|
@@ -26698,7 +26701,7 @@ var markdownFiles = pgTable80(
|
|
|
26698
26701
|
createdAt: timestamp74("created_at").notNull().defaultNow(),
|
|
26699
26702
|
updatedAt: timestamp74("updated_at").notNull().defaultNow()
|
|
26700
26703
|
},
|
|
26701
|
-
(t) => [
|
|
26704
|
+
(t) => [uniqueIndex34("markdown_files_project_path_idx").on(t.projectId, t.path)]
|
|
26702
26705
|
);
|
|
26703
26706
|
var DEFAULT_AEO_CONFIG = {
|
|
26704
26707
|
llmsTxtEnabled: true,
|
|
@@ -26715,8 +26718,8 @@ import {
|
|
|
26715
26718
|
jsonb as jsonb44,
|
|
26716
26719
|
integer as integer39,
|
|
26717
26720
|
foreignKey as foreignKey4,
|
|
26718
|
-
index as
|
|
26719
|
-
uniqueIndex as
|
|
26721
|
+
index as index71,
|
|
26722
|
+
uniqueIndex as uniqueIndex37
|
|
26720
26723
|
} from "drizzle-orm/pg-core";
|
|
26721
26724
|
import { relations as relations14 } from "drizzle-orm/relations";
|
|
26722
26725
|
import { sql as sql19 } from "drizzle-orm";
|
|
@@ -26724,13 +26727,13 @@ import { sql as sql19 } from "drizzle-orm";
|
|
|
26724
26727
|
// src/schema/component_variant_groups.ts
|
|
26725
26728
|
import {
|
|
26726
26729
|
foreignKey as foreignKey2,
|
|
26727
|
-
index as
|
|
26730
|
+
index as index69,
|
|
26728
26731
|
integer as integer38,
|
|
26729
26732
|
jsonb as jsonb43,
|
|
26730
26733
|
pgTable as pgTable81,
|
|
26731
26734
|
text as text82,
|
|
26732
26735
|
timestamp as timestamp75,
|
|
26733
|
-
uniqueIndex as
|
|
26736
|
+
uniqueIndex as uniqueIndex35,
|
|
26734
26737
|
varchar as varchar60
|
|
26735
26738
|
} from "drizzle-orm/pg-core";
|
|
26736
26739
|
import { sql as sql17 } from "drizzle-orm";
|
|
@@ -26757,19 +26760,19 @@ var componentVariantGroups = pgTable81(
|
|
|
26757
26760
|
foreignColumns: [projects.id, projects.workspaceId],
|
|
26758
26761
|
name: "component_variant_groups_project_workspace_fkey"
|
|
26759
26762
|
}).onDelete("cascade"),
|
|
26760
|
-
|
|
26761
|
-
|
|
26762
|
-
|
|
26763
|
+
index69("component_variant_groups_workspace_idx").on(table.workspaceId),
|
|
26764
|
+
index69("component_variant_groups_project_idx").on(table.projectId),
|
|
26765
|
+
uniqueIndex35("component_variant_groups_scope_slug_unique").on(table.workspaceId, table.projectId, table.slug).where(sql17`${table.deletedAt} IS NULL`)
|
|
26763
26766
|
]
|
|
26764
26767
|
);
|
|
26765
26768
|
|
|
26766
26769
|
// src/schema/component_groups.ts
|
|
26767
26770
|
import {
|
|
26768
26771
|
foreignKey as foreignKey3,
|
|
26769
|
-
index as
|
|
26772
|
+
index as index70,
|
|
26770
26773
|
pgTable as pgTable82,
|
|
26771
26774
|
text as text83,
|
|
26772
|
-
uniqueIndex as
|
|
26775
|
+
uniqueIndex as uniqueIndex36,
|
|
26773
26776
|
varchar as varchar61
|
|
26774
26777
|
} from "drizzle-orm/pg-core";
|
|
26775
26778
|
import { sql as sql18 } from "drizzle-orm";
|
|
@@ -26791,9 +26794,9 @@ var componentGroups = pgTable82(
|
|
|
26791
26794
|
foreignColumns: [projects.id, projects.workspaceId],
|
|
26792
26795
|
name: "component_groups_project_workspace_fkey"
|
|
26793
26796
|
}).onDelete("cascade"),
|
|
26794
|
-
|
|
26795
|
-
|
|
26796
|
-
|
|
26797
|
+
index70("component_groups_workspace_idx").on(table.workspaceId),
|
|
26798
|
+
index70("component_groups_project_idx").on(table.projectId),
|
|
26799
|
+
uniqueIndex36("component_groups_project_slug_unique").on(table.projectId, table.slug).where(sql18`${table.deletedAt} IS NULL`)
|
|
26797
26800
|
]
|
|
26798
26801
|
);
|
|
26799
26802
|
|
|
@@ -26947,10 +26950,10 @@ var components = pgTable83(
|
|
|
26947
26950
|
foreignColumns: [projects.id, projects.workspaceId],
|
|
26948
26951
|
name: "components_project_workspace_fkey"
|
|
26949
26952
|
}).onDelete("cascade"),
|
|
26950
|
-
|
|
26951
|
-
|
|
26952
|
-
|
|
26953
|
-
|
|
26953
|
+
index71("components_workspace_idx").on(table.workspaceId),
|
|
26954
|
+
index71("components_project_idx").on(table.projectId),
|
|
26955
|
+
index71("components_group_idx").on(table.groupId),
|
|
26956
|
+
index71("components_variant_group_idx").on(table.variantGroupId),
|
|
26954
26957
|
/**
|
|
26955
26958
|
* One row per slug PER MANAGER, among live rows. Migration 0222 widened this from
|
|
26956
26959
|
* (workspace_id, project_id, slug) so a repo-pushed section can coexist with — and shadow —
|
|
@@ -26969,15 +26972,15 @@ var components = pgTable83(
|
|
|
26969
26972
|
* src/lib/sections/registry.ts, which is handed every candidate and applies precedence
|
|
26970
26973
|
* itself. DB uniqueness here is data hygiene, not verdict correctness.
|
|
26971
26974
|
*/
|
|
26972
|
-
|
|
26973
|
-
|
|
26975
|
+
uniqueIndex37("components_ws_proj_slug_managed_idx").on(table.workspaceId, table.projectId, table.branchId, table.slug, table.managedBy).where(sql19`${table.deletedAt} IS NULL`),
|
|
26976
|
+
index71("components_managed_by_idx").on(table.managedBy).where(sql19`${table.deletedAt} IS NULL`),
|
|
26974
26977
|
// Partial: the section library only reads live sections. Mirrors migration 0156 —
|
|
26975
26978
|
// keep the two in step, or `drizzle-kit push` will want to drop the index it can't see.
|
|
26976
|
-
|
|
26979
|
+
index71("components_section_type_idx").on(table.sectionType).where(sql19`${table.sectionType} IS NOT NULL AND ${table.deletedAt} IS NULL`),
|
|
26977
26980
|
// Migration 0342. Deliberately NOT unique: one band can produce several components when its
|
|
26978
26981
|
// shape differs between pages (`hero`, `hero-2`), so this is a lookup hint the planner uses
|
|
26979
26982
|
// only when exactly one row carries the key — not a key.
|
|
26980
|
-
|
|
26983
|
+
index71("components_ws_proj_source_key_idx").on(table.workspaceId, table.projectId, table.branchId, table.sourceKey).where(sql19`${table.sourceKey} IS NOT NULL AND ${table.deletedAt} IS NULL`)
|
|
26981
26984
|
]
|
|
26982
26985
|
);
|
|
26983
26986
|
var componentsRelations = relations14(components, ({ one }) => ({
|
|
@@ -26996,7 +26999,7 @@ var componentsRelations = relations14(components, ({ one }) => ({
|
|
|
26996
26999
|
}));
|
|
26997
27000
|
|
|
26998
27001
|
// src/schema/content_navigation.ts
|
|
26999
|
-
import { foreignKey as foreignKey5, index as
|
|
27002
|
+
import { foreignKey as foreignKey5, index as index72, integer as integer40, jsonb as jsonb45, pgTable as pgTable84, text as text85, timestamp as timestamp77 } from "drizzle-orm/pg-core";
|
|
27000
27003
|
var contentNavigation = pgTable84(
|
|
27001
27004
|
"content_navigation",
|
|
27002
27005
|
{
|
|
@@ -27014,12 +27017,12 @@ var contentNavigation = pgTable84(
|
|
|
27014
27017
|
foreignColumns: [projects.id, projects.workspaceId],
|
|
27015
27018
|
name: "content_navigation_project_workspace_fkey"
|
|
27016
27019
|
}).onDelete("cascade").onUpdate("cascade"),
|
|
27017
|
-
|
|
27020
|
+
index72("content_navigation_workspace_idx").on(table.workspaceId)
|
|
27018
27021
|
]
|
|
27019
27022
|
);
|
|
27020
27023
|
|
|
27021
27024
|
// src/schema/page_stars.ts
|
|
27022
|
-
import { index as
|
|
27025
|
+
import { index as index73, pgTable as pgTable85, primaryKey as primaryKey7, text as text86, timestamp as timestamp78 } from "drizzle-orm/pg-core";
|
|
27023
27026
|
var pageStars = pgTable85(
|
|
27024
27027
|
"page_stars",
|
|
27025
27028
|
{
|
|
@@ -27031,12 +27034,12 @@ var pageStars = pgTable85(
|
|
|
27031
27034
|
},
|
|
27032
27035
|
(t) => [
|
|
27033
27036
|
primaryKey7({ columns: [t.userId, t.pageId] }),
|
|
27034
|
-
|
|
27037
|
+
index73("page_stars_project_user_idx").on(t.workspaceId, t.projectId, t.userId)
|
|
27035
27038
|
]
|
|
27036
27039
|
);
|
|
27037
27040
|
|
|
27038
27041
|
// src/schema/saved_blocks.ts
|
|
27039
|
-
import { index as
|
|
27042
|
+
import { index as index74, jsonb as jsonb46, pgTable as pgTable86, text as text87, timestamp as timestamp79, varchar as varchar63 } from "drizzle-orm/pg-core";
|
|
27040
27043
|
var savedBlocks = pgTable86(
|
|
27041
27044
|
"saved_blocks",
|
|
27042
27045
|
{
|
|
@@ -27054,11 +27057,11 @@ var savedBlocks = pgTable86(
|
|
|
27054
27057
|
createdBy: text87("created_by").references(() => users.id, { onDelete: "set null" }),
|
|
27055
27058
|
createdAt: timestamp79("created_at").notNull().defaultNow()
|
|
27056
27059
|
},
|
|
27057
|
-
(t) => [
|
|
27060
|
+
(t) => [index74("saved_blocks_project_idx").on(t.workspaceId, t.projectId, t.createdAt)]
|
|
27058
27061
|
);
|
|
27059
27062
|
|
|
27060
27063
|
// src/schema/entry_slot_models.ts
|
|
27061
|
-
import { index as
|
|
27064
|
+
import { index as index75, integer as integer41, jsonb as jsonb47, pgTable as pgTable87, primaryKey as primaryKey8, real as real2, text as text88, timestamp as timestamp80, varchar as varchar64 } from "drizzle-orm/pg-core";
|
|
27062
27065
|
var entrySlotModels = pgTable87(
|
|
27063
27066
|
"entry_slot_models",
|
|
27064
27067
|
{
|
|
@@ -27081,12 +27084,12 @@ var entrySlotModels = pgTable87(
|
|
|
27081
27084
|
},
|
|
27082
27085
|
(t) => [
|
|
27083
27086
|
primaryKey8({ name: "entry_slot_models_pkey", columns: [t.projectId, t.releaseSha, t.templateSig, t.path] }),
|
|
27084
|
-
|
|
27087
|
+
index75("entry_slot_models_project_sha_idx").on(t.workspaceId, t.projectId, t.releaseSha)
|
|
27085
27088
|
]
|
|
27086
27089
|
);
|
|
27087
27090
|
|
|
27088
27091
|
// src/schema/content_model_versions.ts
|
|
27089
|
-
import { index as
|
|
27092
|
+
import { index as index76, integer as integer42, jsonb as jsonb48, pgTable as pgTable88, text as text89, timestamp as timestamp81 } from "drizzle-orm/pg-core";
|
|
27090
27093
|
var contentModelVersions = pgTable88(
|
|
27091
27094
|
"content_model_versions",
|
|
27092
27095
|
{
|
|
@@ -27102,7 +27105,7 @@ var contentModelVersions = pgTable88(
|
|
|
27102
27105
|
createdBy: text89("created_by").references(() => users.id, { onDelete: "set null" }),
|
|
27103
27106
|
createdAt: timestamp81("created_at").notNull().defaultNow()
|
|
27104
27107
|
},
|
|
27105
|
-
(t) => [
|
|
27108
|
+
(t) => [index76("content_model_versions_model_version_idx").on(t.modelId, t.version.desc())]
|
|
27106
27109
|
);
|
|
27107
27110
|
|
|
27108
27111
|
// src/schema/component_variants.ts
|
|
@@ -27113,9 +27116,9 @@ import {
|
|
|
27113
27116
|
timestamp as timestamp82,
|
|
27114
27117
|
jsonb as jsonb49,
|
|
27115
27118
|
integer as integer43,
|
|
27116
|
-
index as
|
|
27119
|
+
index as index77,
|
|
27117
27120
|
unique as unique4,
|
|
27118
|
-
uniqueIndex as
|
|
27121
|
+
uniqueIndex as uniqueIndex38
|
|
27119
27122
|
} from "drizzle-orm/pg-core";
|
|
27120
27123
|
import { relations as relations15 } from "drizzle-orm/relations";
|
|
27121
27124
|
import { sql as sql20 } from "drizzle-orm";
|
|
@@ -27150,9 +27153,9 @@ var componentVariants = pgTable89(
|
|
|
27150
27153
|
table.workspaceId,
|
|
27151
27154
|
table.componentId
|
|
27152
27155
|
),
|
|
27153
|
-
|
|
27154
|
-
|
|
27155
|
-
|
|
27156
|
+
index77("component_variants_workspace_idx").on(table.workspaceId),
|
|
27157
|
+
index77("component_variants_component_idx").on(table.componentId),
|
|
27158
|
+
uniqueIndex38("component_variants_component_key_unique").on(table.componentId, table.key).where(sql20`${table.deletedAt} IS NULL`)
|
|
27156
27159
|
]
|
|
27157
27160
|
);
|
|
27158
27161
|
var componentVariantsRelations = relations15(componentVariants, ({ one }) => ({
|
|
@@ -27170,14 +27173,14 @@ var componentVariantsRelations = relations15(componentVariants, ({ one }) => ({
|
|
|
27170
27173
|
import {
|
|
27171
27174
|
bigint as bigint4,
|
|
27172
27175
|
foreignKey as foreignKey6,
|
|
27173
|
-
index as
|
|
27176
|
+
index as index78,
|
|
27174
27177
|
integer as integer44,
|
|
27175
27178
|
jsonb as jsonb50,
|
|
27176
27179
|
pgTable as pgTable90,
|
|
27177
27180
|
text as text91,
|
|
27178
27181
|
timestamp as timestamp83,
|
|
27179
27182
|
unique as unique5,
|
|
27180
|
-
uniqueIndex as
|
|
27183
|
+
uniqueIndex as uniqueIndex39,
|
|
27181
27184
|
uuid as uuid2,
|
|
27182
27185
|
varchar as varchar66
|
|
27183
27186
|
} from "drizzle-orm/pg-core";
|
|
@@ -27211,7 +27214,7 @@ var componentImplementationCandidates = pgTable90(
|
|
|
27211
27214
|
// v1 candidates (created before 0263) have no exact family-contract bytes. They must not
|
|
27212
27215
|
// occupy the v2 tuple: validation needs to append an exact candidate beside the legacy
|
|
27213
27216
|
// row instead of either mutating it or selecting it by matching hashes alone.
|
|
27214
|
-
|
|
27217
|
+
uniqueIndex39("component_implementation_candidate_exact_tuple_unique").on(
|
|
27215
27218
|
table.projectId,
|
|
27216
27219
|
table.componentId,
|
|
27217
27220
|
table.schemaHash,
|
|
@@ -27219,7 +27222,7 @@ var componentImplementationCandidates = pgTable90(
|
|
|
27219
27222
|
table.familyContractHash
|
|
27220
27223
|
).where(sql21`${table.familyContract} IS NOT NULL`),
|
|
27221
27224
|
unique5("component_implementation_candidate_scope_unique").on(table.id, table.projectId, table.componentId),
|
|
27222
|
-
|
|
27225
|
+
index78("component_implementation_candidates_component_idx").on(table.projectId, table.componentId)
|
|
27223
27226
|
]
|
|
27224
27227
|
);
|
|
27225
27228
|
var componentFamilyManifests = pgTable90(
|
|
@@ -27249,8 +27252,8 @@ var componentFamilyManifests = pgTable90(
|
|
|
27249
27252
|
unique5("component_family_manifests_scope_unique").on(table.id, table.projectId, table.familyKey),
|
|
27250
27253
|
unique5("component_family_manifests_id_project_unique").on(table.id, table.projectId),
|
|
27251
27254
|
unique5("component_family_manifests_evidence_unique").on(table.id, table.projectId, table.manifestHash),
|
|
27252
|
-
|
|
27253
|
-
|
|
27255
|
+
uniqueIndex39("component_family_manifest_tuple_unique").on(table.projectId, table.familyKey, table.manifestHash),
|
|
27256
|
+
index78("component_family_manifests_family_idx").on(table.projectId, table.familyKey, table.createdAt)
|
|
27254
27257
|
]
|
|
27255
27258
|
);
|
|
27256
27259
|
var componentImplementationRequests = pgTable90(
|
|
@@ -27304,8 +27307,8 @@ var componentImplementationRequests = pgTable90(
|
|
|
27304
27307
|
name: "component_implementation_requests_candidate_fkey"
|
|
27305
27308
|
}).onDelete("cascade"),
|
|
27306
27309
|
unique5("component_implementation_requests_scope_unique").on(table.id, table.projectId, table.componentId),
|
|
27307
|
-
|
|
27308
|
-
|
|
27310
|
+
uniqueIndex39("component_implementation_requests_active_unique").on(table.projectId, table.componentId).where(sql21`${table.status} IN ('pending', 'claimed')`),
|
|
27311
|
+
index78("component_implementation_requests_claimable_idx").on(table.projectId, table.status, table.expiresAt, table.createdAt)
|
|
27309
27312
|
]
|
|
27310
27313
|
);
|
|
27311
27314
|
var componentImplementationEvidence = pgTable90(
|
|
@@ -27356,10 +27359,10 @@ var componentImplementationEvidence = pgTable90(
|
|
|
27356
27359
|
foreignColumns: [componentImplementationRequests.id, componentImplementationRequests.projectId, componentImplementationRequests.componentId],
|
|
27357
27360
|
name: "component_implementation_evidence_request_fkey"
|
|
27358
27361
|
}).onDelete("restrict"),
|
|
27359
|
-
|
|
27360
|
-
|
|
27362
|
+
uniqueIndex39("component_implementation_evidence_digest_unique").on(table.projectId, table.componentId, table.evidenceDigest),
|
|
27363
|
+
uniqueIndex39("component_implementation_evidence_request_unique").on(table.requestId).where(sql21`${table.requestId} IS NOT NULL`),
|
|
27361
27364
|
unique5("component_implementation_evidence_scope_unique").on(table.id, table.projectId, table.componentId),
|
|
27362
|
-
|
|
27365
|
+
index78("component_implementation_evidence_candidate_idx").on(table.candidateId, table.createdAt)
|
|
27363
27366
|
]
|
|
27364
27367
|
);
|
|
27365
27368
|
var componentImplementationApprovals = pgTable90(
|
|
@@ -27390,9 +27393,9 @@ var componentImplementationApprovals = pgTable90(
|
|
|
27390
27393
|
foreignColumns: [componentImplementationEvidence.id, componentImplementationEvidence.projectId, componentImplementationEvidence.componentId],
|
|
27391
27394
|
name: "component_implementation_approvals_evidence_fkey"
|
|
27392
27395
|
}).onDelete("cascade"),
|
|
27393
|
-
|
|
27396
|
+
uniqueIndex39("component_implementation_approval_evidence_unique").on(table.evidenceId),
|
|
27394
27397
|
unique5("component_implementation_approval_scope_unique").on(table.id, table.projectId, table.componentId),
|
|
27395
|
-
|
|
27398
|
+
index78("component_implementation_approvals_component_idx").on(table.projectId, table.componentId)
|
|
27396
27399
|
]
|
|
27397
27400
|
);
|
|
27398
27401
|
var componentImplementationAdapters = pgTable90(
|
|
@@ -27420,7 +27423,7 @@ var componentImplementationAdapters = pgTable90(
|
|
|
27420
27423
|
name: "component_implementation_adapters_scope_fkey"
|
|
27421
27424
|
}).onDelete("cascade"),
|
|
27422
27425
|
unique5("component_implementation_adapters_component_unique").on(table.projectId, table.componentId),
|
|
27423
|
-
|
|
27426
|
+
index78("component_implementation_adapters_project_idx").on(table.projectId, table.componentId)
|
|
27424
27427
|
]
|
|
27425
27428
|
);
|
|
27426
27429
|
var componentImplementationStates = pgTable90(
|
|
@@ -27451,8 +27454,8 @@ var componentImplementationStates = pgTable90(
|
|
|
27451
27454
|
foreignColumns: [projects.id, projects.workspaceId],
|
|
27452
27455
|
name: "component_implementation_states_project_workspace_fkey"
|
|
27453
27456
|
}).onDelete("cascade"),
|
|
27454
|
-
|
|
27455
|
-
|
|
27457
|
+
uniqueIndex39("component_implementation_states_component_unique").on(table.projectId, table.componentId),
|
|
27458
|
+
index78("component_implementation_states_workspace_idx").on(table.workspaceId)
|
|
27456
27459
|
]
|
|
27457
27460
|
);
|
|
27458
27461
|
var componentPreviewSources = pgTable90(
|
|
@@ -27478,7 +27481,7 @@ var componentPreviewSources = pgTable90(
|
|
|
27478
27481
|
name: "component_preview_sources_scope_fkey"
|
|
27479
27482
|
}).onDelete("cascade"),
|
|
27480
27483
|
unique5("component_preview_sources_component_unique").on(table.projectId, table.componentId),
|
|
27481
|
-
|
|
27484
|
+
index78("component_preview_sources_project_idx").on(table.projectId)
|
|
27482
27485
|
]
|
|
27483
27486
|
);
|
|
27484
27487
|
var componentPreviewBundles = pgTable90(
|
|
@@ -27508,7 +27511,7 @@ var componentPreviewBundles = pgTable90(
|
|
|
27508
27511
|
name: "component_preview_bundles_scope_fkey"
|
|
27509
27512
|
}).onDelete("cascade"),
|
|
27510
27513
|
unique5("component_preview_bundles_commit_unique").on(table.projectId, table.commitSha),
|
|
27511
|
-
|
|
27514
|
+
index78("component_preview_bundles_project_idx").on(table.projectId, table.createdAt)
|
|
27512
27515
|
]
|
|
27513
27516
|
);
|
|
27514
27517
|
|
|
@@ -27517,7 +27520,7 @@ import { sql as sql22 } from "drizzle-orm";
|
|
|
27517
27520
|
import {
|
|
27518
27521
|
check as check5,
|
|
27519
27522
|
foreignKey as foreignKey7,
|
|
27520
|
-
index as
|
|
27523
|
+
index as index79,
|
|
27521
27524
|
integer as integer45,
|
|
27522
27525
|
jsonb as jsonb51,
|
|
27523
27526
|
pgTable as pgTable91,
|
|
@@ -27525,7 +27528,7 @@ import {
|
|
|
27525
27528
|
text as text92,
|
|
27526
27529
|
timestamp as timestamp84,
|
|
27527
27530
|
unique as unique6,
|
|
27528
|
-
uniqueIndex as
|
|
27531
|
+
uniqueIndex as uniqueIndex40,
|
|
27529
27532
|
uuid as uuid3,
|
|
27530
27533
|
varchar as varchar67
|
|
27531
27534
|
} from "drizzle-orm/pg-core";
|
|
@@ -27555,7 +27558,7 @@ var projectOrchestrationStates = pgTable91(
|
|
|
27555
27558
|
}).onDelete("cascade"),
|
|
27556
27559
|
unique6("project_orchestration_states_scope_unique").on(table.projectId, table.workspaceId),
|
|
27557
27560
|
check5("project_orchestration_states_generation_check", sql22`${table.generation} >= 2`),
|
|
27558
|
-
|
|
27561
|
+
index79("project_orchestration_states_workspace_idx").on(table.workspaceId)
|
|
27559
27562
|
]
|
|
27560
27563
|
);
|
|
27561
27564
|
var orchestrationRuns = pgTable91(
|
|
@@ -27602,15 +27605,15 @@ var orchestrationRuns = pgTable91(
|
|
|
27602
27605
|
table.projectId,
|
|
27603
27606
|
table.startIdempotencyKey
|
|
27604
27607
|
),
|
|
27605
|
-
|
|
27606
|
-
|
|
27608
|
+
uniqueIndex40("orchestration_runs_nonterminal_project_unique").on(table.projectId).where(sql22`${table.status} IN ('open', 'paused', 'cancelling')`),
|
|
27609
|
+
index79("orchestration_runs_project_target_idx").on(
|
|
27607
27610
|
table.projectId,
|
|
27608
27611
|
table.targetKind,
|
|
27609
27612
|
table.targetId,
|
|
27610
27613
|
table.targetVariantId,
|
|
27611
27614
|
table.createdAt
|
|
27612
27615
|
),
|
|
27613
|
-
|
|
27616
|
+
index79("orchestration_runs_workspace_status_idx").on(
|
|
27614
27617
|
table.workspaceId,
|
|
27615
27618
|
table.status,
|
|
27616
27619
|
table.updatedAt
|
|
@@ -27713,7 +27716,7 @@ var orchestrationRunStartKeys = pgTable91(
|
|
|
27713
27716
|
foreignColumns: [orchestrationRuns.id, orchestrationRuns.workspaceId, orchestrationRuns.projectId],
|
|
27714
27717
|
name: "orchestration_run_start_keys_run_scope_fkey"
|
|
27715
27718
|
}).onDelete("cascade"),
|
|
27716
|
-
|
|
27719
|
+
index79("orchestration_run_start_keys_run_created_idx").on(table.runId, table.createdAt),
|
|
27717
27720
|
check5(
|
|
27718
27721
|
"orchestration_run_start_keys_idempotency_key_check",
|
|
27719
27722
|
sql22`length(btrim(${table.idempotencyKey})) BETWEEN 1 AND 255`
|
|
@@ -27749,7 +27752,7 @@ var orchestrationRunEvents = pgTable91(
|
|
|
27749
27752
|
}).onDelete("cascade"),
|
|
27750
27753
|
unique6("orchestration_run_events_sequence_unique").on(table.runId, table.sequence),
|
|
27751
27754
|
unique6("orchestration_run_events_idempotency_unique").on(table.runId, table.idempotencyKey),
|
|
27752
|
-
|
|
27755
|
+
index79("orchestration_run_events_project_created_idx").on(table.projectId, table.createdAt),
|
|
27753
27756
|
check5("orchestration_run_events_sequence_check", sql22`${table.sequence} >= 1`),
|
|
27754
27757
|
check5("orchestration_run_events_schema_version_check", sql22`${table.schemaVersion} >= 1`),
|
|
27755
27758
|
check5(
|
|
@@ -27786,8 +27789,8 @@ var orchestrationRunCommandResults = pgTable91(
|
|
|
27786
27789
|
foreignColumns: [orchestrationRuns.id, orchestrationRuns.workspaceId, orchestrationRuns.projectId],
|
|
27787
27790
|
name: "orchestration_run_command_results_run_scope_fkey"
|
|
27788
27791
|
}).onDelete("cascade"),
|
|
27789
|
-
|
|
27790
|
-
|
|
27792
|
+
index79("orchestration_run_command_results_run_created_idx").on(table.runId, table.createdAt),
|
|
27793
|
+
index79("orchestration_run_command_results_project_created_idx").on(
|
|
27791
27794
|
table.projectId,
|
|
27792
27795
|
table.createdAt
|
|
27793
27796
|
),
|
|
@@ -27821,14 +27824,14 @@ import {
|
|
|
27821
27824
|
boolean as boolean30,
|
|
27822
27825
|
check as check6,
|
|
27823
27826
|
foreignKey as foreignKey8,
|
|
27824
|
-
index as
|
|
27827
|
+
index as index80,
|
|
27825
27828
|
integer as integer46,
|
|
27826
27829
|
jsonb as jsonb52,
|
|
27827
27830
|
pgTable as pgTable92,
|
|
27828
27831
|
text as text93,
|
|
27829
27832
|
timestamp as timestamp85,
|
|
27830
27833
|
unique as unique7,
|
|
27831
|
-
uniqueIndex as
|
|
27834
|
+
uniqueIndex as uniqueIndex41,
|
|
27832
27835
|
uuid as uuid4,
|
|
27833
27836
|
varchar as varchar68
|
|
27834
27837
|
} from "drizzle-orm/pg-core";
|
|
@@ -27897,12 +27900,12 @@ var orchestrationExecutorInstallations = pgTable92(
|
|
|
27897
27900
|
table.workspaceId,
|
|
27898
27901
|
table.projectId
|
|
27899
27902
|
),
|
|
27900
|
-
|
|
27903
|
+
index80("orchestration_executor_installations_project_status_idx").on(
|
|
27901
27904
|
table.projectId,
|
|
27902
27905
|
table.status
|
|
27903
27906
|
),
|
|
27904
|
-
|
|
27905
|
-
|
|
27907
|
+
uniqueIndex41("orchestration_executor_installations_grant_unique").on(table.projectId, table.grantId).where(sql23`${table.grantId} IS NOT NULL AND ${table.status} = 'active'`),
|
|
27908
|
+
uniqueIndex41("orchestration_executor_installations_dashboard_unique").on(table.projectId).where(sql23`${table.kind} = 'dashboard-agent' AND ${table.status} = 'active'`),
|
|
27906
27909
|
check6(
|
|
27907
27910
|
"orchestration_executor_installations_kind_check",
|
|
27908
27911
|
sql23`${table.kind} IN ('dashboard-agent', 'native-bridge')`
|
|
@@ -27972,11 +27975,11 @@ var orchestrationExecutorSessions = pgTable92(
|
|
|
27972
27975
|
table.installationId,
|
|
27973
27976
|
table.sessionEpoch
|
|
27974
27977
|
),
|
|
27975
|
-
|
|
27978
|
+
index80("orchestration_executor_sessions_installation_state_idx").on(
|
|
27976
27979
|
table.installationId,
|
|
27977
27980
|
table.state
|
|
27978
27981
|
),
|
|
27979
|
-
|
|
27982
|
+
index80("orchestration_executor_sessions_liveness_idx").on(table.serverReceivedAt).where(sql23`${table.state} = 'open'`),
|
|
27980
27983
|
check6("orchestration_executor_sessions_epoch_check", sql23`${table.sessionEpoch} >= 1`),
|
|
27981
27984
|
check6(
|
|
27982
27985
|
"orchestration_executor_sessions_state_check",
|
|
@@ -28067,7 +28070,7 @@ var orchestrationImplementationAttempts = pgTable92(
|
|
|
28067
28070
|
table.runId,
|
|
28068
28071
|
table.attemptNumber
|
|
28069
28072
|
),
|
|
28070
|
-
|
|
28073
|
+
index80("orchestration_implementation_attempts_run_created_idx").on(
|
|
28071
28074
|
table.runId,
|
|
28072
28075
|
table.createdAt
|
|
28073
28076
|
),
|
|
@@ -28111,7 +28114,7 @@ var orchestrationPlanSnapshots = pgTable92(
|
|
|
28111
28114
|
byteCount: bigint5("byte_count", { mode: "number" }).notNull(),
|
|
28112
28115
|
createdAt: timestamp85("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
28113
28116
|
},
|
|
28114
|
-
(table) => [
|
|
28117
|
+
(table) => [index80("orchestration_plan_snapshots_project_idx").on(table.workspaceId, table.projectId, table.createdAt)]
|
|
28115
28118
|
);
|
|
28116
28119
|
var orchestrationVisualApprovals = pgTable92(
|
|
28117
28120
|
"orchestration_visual_approvals",
|
|
@@ -28263,7 +28266,7 @@ var orchestrationExecutionApprovals = pgTable92(
|
|
|
28263
28266
|
// One approval per attempt. A running implementation never introduces a second approval; a
|
|
28264
28267
|
// changed binding requires a NEW attempt, which is what makes the authority auditable.
|
|
28265
28268
|
unique7("orchestration_execution_approvals_attempt_unique").on(table.attemptId),
|
|
28266
|
-
|
|
28269
|
+
index80("orchestration_execution_approvals_run_created_idx").on(table.runId, table.createdAt),
|
|
28267
28270
|
check6(
|
|
28268
28271
|
"orchestration_execution_approvals_idempotency_key_check",
|
|
28269
28272
|
sql23`length(btrim(${table.idempotencyKey})) BETWEEN 1 AND 255`
|
|
@@ -28363,8 +28366,8 @@ var orchestrationExecutorLeases = pgTable92(
|
|
|
28363
28366
|
),
|
|
28364
28367
|
unique7("orchestration_executor_leases_epoch_unique").on(table.attemptId, table.leaseEpoch),
|
|
28365
28368
|
// Plan invariant 6, enforced in the database: a run has at most one active executor lease.
|
|
28366
|
-
|
|
28367
|
-
|
|
28369
|
+
uniqueIndex41("orchestration_executor_leases_one_active_per_run").on(table.runId).where(sql23`${table.state} = 'active'`),
|
|
28370
|
+
index80("orchestration_executor_leases_deadline_idx").on(table.heartbeatDeadline).where(sql23`${table.state} = 'active'`),
|
|
28368
28371
|
check6("orchestration_executor_leases_epoch_check", sql23`${table.leaseEpoch} >= 1`),
|
|
28369
28372
|
check6(
|
|
28370
28373
|
"orchestration_executor_leases_state_check",
|
|
@@ -28435,9 +28438,9 @@ var orchestrationExecutorCommands = pgTable92(
|
|
|
28435
28438
|
table.runId,
|
|
28436
28439
|
table.idempotencyKey
|
|
28437
28440
|
),
|
|
28438
|
-
|
|
28441
|
+
index80("orchestration_executor_commands_run_sequence_idx").on(table.runId, table.sequence),
|
|
28439
28442
|
// The long-poll cursor read: unacknowledged commands for a run, in order.
|
|
28440
|
-
|
|
28443
|
+
index80("orchestration_executor_commands_pending_idx").on(table.runId, table.sequence).where(sql23`${table.acknowledgedAt} IS NULL`),
|
|
28441
28444
|
check6("orchestration_executor_commands_sequence_check", sql23`${table.sequence} >= 1`),
|
|
28442
28445
|
check6(
|
|
28443
28446
|
"orchestration_executor_commands_kind_check",
|
|
@@ -28508,7 +28511,7 @@ var orchestrationPatchManifests = pgTable92(
|
|
|
28508
28511
|
}).onDelete("cascade"),
|
|
28509
28512
|
unique7("orchestration_patch_manifests_sequence_unique").on(table.attemptId, table.sequence),
|
|
28510
28513
|
unique7("orchestration_patch_manifests_path_unique").on(table.attemptId, table.path),
|
|
28511
|
-
|
|
28514
|
+
index80("orchestration_patch_manifests_attempt_sequence_idx").on(table.attemptId, table.sequence),
|
|
28512
28515
|
check6("orchestration_patch_manifests_sequence_check", sql23`${table.sequence} >= 1`),
|
|
28513
28516
|
check6(
|
|
28514
28517
|
"orchestration_patch_manifests_operation_check",
|
|
@@ -28582,11 +28585,11 @@ var orchestrationPullRequestReceipts = pgTable92(
|
|
|
28582
28585
|
table.attemptId,
|
|
28583
28586
|
table.generation
|
|
28584
28587
|
),
|
|
28585
|
-
|
|
28588
|
+
index80("orchestration_pull_request_receipts_attempt_generation_idx").on(
|
|
28586
28589
|
table.attemptId,
|
|
28587
28590
|
table.generation
|
|
28588
28591
|
),
|
|
28589
|
-
|
|
28592
|
+
index80("orchestration_pull_request_receipts_head_idx").on(table.repositoryId, table.headSha),
|
|
28590
28593
|
check6("orchestration_pull_request_receipts_generation_check", sql23`${table.generation} >= 1`),
|
|
28591
28594
|
check6("orchestration_pull_request_receipts_number_check", sql23`${table.pullRequestNumber} >= 1`),
|
|
28592
28595
|
check6(
|
|
@@ -28615,7 +28618,7 @@ var orchestrationPullRequestReceipts = pgTable92(
|
|
|
28615
28618
|
|
|
28616
28619
|
// src/schema/conversion_proposals.ts
|
|
28617
28620
|
import { sql as sql24 } from "drizzle-orm";
|
|
28618
|
-
import { check as check7, foreignKey as foreignKey9, index as
|
|
28621
|
+
import { check as check7, foreignKey as foreignKey9, index as index81, integer as integer47, jsonb as jsonb53, pgTable as pgTable93, text as text94, timestamp as timestamp86, unique as unique8, uuid as uuid5, varchar as varchar69 } from "drizzle-orm/pg-core";
|
|
28619
28622
|
var CONVERSION_PROPOSAL_STATUSES = ["draft", "approved", "superseded"];
|
|
28620
28623
|
var conversionProposals = pgTable93(
|
|
28621
28624
|
"conversion_proposals",
|
|
@@ -28658,7 +28661,7 @@ var conversionProposals = pgTable93(
|
|
|
28658
28661
|
supersededReason: text94("superseded_reason")
|
|
28659
28662
|
},
|
|
28660
28663
|
(table) => [
|
|
28661
|
-
|
|
28664
|
+
index81("conversion_proposals_project_idx").on(table.workspaceId, table.projectId, table.createdAt),
|
|
28662
28665
|
unique8("conversion_proposals_idempotency_unique").on(table.projectId, table.idempotencyKey),
|
|
28663
28666
|
foreignKey9({
|
|
28664
28667
|
columns: [table.projectId, table.workspaceId],
|
|
@@ -28676,7 +28679,7 @@ var conversionProposals = pgTable93(
|
|
|
28676
28679
|
|
|
28677
28680
|
// src/schema/conversion_briefs_issued.ts
|
|
28678
28681
|
import { sql as sql25 } from "drizzle-orm";
|
|
28679
|
-
import { check as check8, foreignKey as foreignKey10, index as
|
|
28682
|
+
import { check as check8, foreignKey as foreignKey10, index as index82, jsonb as jsonb54, pgTable as pgTable94, text as text95, timestamp as timestamp87, unique as unique9, uuid as uuid6 } from "drizzle-orm/pg-core";
|
|
28680
28683
|
var conversionBriefsIssued = pgTable94(
|
|
28681
28684
|
"conversion_briefs_issued",
|
|
28682
28685
|
{
|
|
@@ -28697,7 +28700,7 @@ var conversionBriefsIssued = pgTable94(
|
|
|
28697
28700
|
issuedAt: timestamp87("issued_at", { withTimezone: true }).notNull().defaultNow()
|
|
28698
28701
|
},
|
|
28699
28702
|
(table) => [
|
|
28700
|
-
|
|
28703
|
+
index82("conversion_briefs_issued_project_issued_idx").on(table.projectId, table.issuedAt),
|
|
28701
28704
|
unique9("conversion_briefs_issued_digest_unique").on(table.projectId, table.briefDigest),
|
|
28702
28705
|
foreignKey10({
|
|
28703
28706
|
columns: [table.projectId, table.workspaceId],
|
|
@@ -28711,7 +28714,7 @@ var conversionBriefsIssued = pgTable94(
|
|
|
28711
28714
|
|
|
28712
28715
|
// src/schema/binding_decisions.ts
|
|
28713
28716
|
import { sql as sql26 } from "drizzle-orm";
|
|
28714
|
-
import { index as
|
|
28717
|
+
import { index as index83, jsonb as jsonb55, pgTable as pgTable95, smallint as smallint2, text as text96, timestamp as timestamp88, uniqueIndex as uniqueIndex42, uuid as uuid7 } from "drizzle-orm/pg-core";
|
|
28715
28718
|
var BINDING_DECISION_OPS = ["bind", "code", "reject"];
|
|
28716
28719
|
var BINDING_DECISION_STATES = ["stored", "materialized", "proven", "live", "lost"];
|
|
28717
28720
|
var bindingDecisions = pgTable95(
|
|
@@ -28742,9 +28745,9 @@ var bindingDecisions = pgTable95(
|
|
|
28742
28745
|
updatedAt: timestamp88("updated_at").notNull().defaultNow()
|
|
28743
28746
|
},
|
|
28744
28747
|
(t) => [
|
|
28745
|
-
|
|
28746
|
-
|
|
28747
|
-
|
|
28748
|
+
uniqueIndex42("binding_decisions_target_op_unique").on(t.projectId, t.slot, t.target, t.op),
|
|
28749
|
+
uniqueIndex42("binding_decisions_live_target_unique").on(t.projectId, t.slot, t.target).where(sql26`superseded_reason IS NULL`),
|
|
28750
|
+
index83("binding_decisions_project_slot_state_idx").on(t.projectId, t.slot, t.state)
|
|
28748
28751
|
]
|
|
28749
28752
|
);
|
|
28750
28753
|
|
|
@@ -28754,14 +28757,14 @@ import {
|
|
|
28754
28757
|
bigint as bigint6,
|
|
28755
28758
|
check as check9,
|
|
28756
28759
|
foreignKey as foreignKey11,
|
|
28757
|
-
index as
|
|
28760
|
+
index as index84,
|
|
28758
28761
|
integer as integer48,
|
|
28759
28762
|
jsonb as jsonb56,
|
|
28760
28763
|
pgTable as pgTable96,
|
|
28761
28764
|
text as text97,
|
|
28762
28765
|
timestamp as timestamp89,
|
|
28763
28766
|
unique as unique10,
|
|
28764
|
-
uniqueIndex as
|
|
28767
|
+
uniqueIndex as uniqueIndex43,
|
|
28765
28768
|
uuid as uuid8,
|
|
28766
28769
|
varchar as varchar70
|
|
28767
28770
|
} from "drizzle-orm/pg-core";
|
|
@@ -28844,12 +28847,12 @@ var orchestrationValidationEnvelopes = pgTable96(
|
|
|
28844
28847
|
}).onDelete("set null"),
|
|
28845
28848
|
// One live envelope per (attempt, head): two validators can never both be authoritative for
|
|
28846
28849
|
// the same commit. The index arbitrates, so no read-then-write can lose the race.
|
|
28847
|
-
|
|
28848
|
-
|
|
28850
|
+
uniqueIndex43("orchestration_validation_envelopes_one_live_per_head").on(table.attemptId, table.headSha).where(sql27`status IN ('queued', 'dispatched', 'action_required')`),
|
|
28851
|
+
index84("orchestration_validation_envelopes_attempt_idx").on(
|
|
28849
28852
|
table.attemptId,
|
|
28850
28853
|
table.createdAt.desc()
|
|
28851
28854
|
),
|
|
28852
|
-
|
|
28855
|
+
index84("orchestration_validation_envelopes_sweep_idx").on(table.status, table.nonceExpiresAt).where(sql27`status IN ('queued', 'dispatched')`),
|
|
28853
28856
|
check9(
|
|
28854
28857
|
"orchestration_validation_envelopes_status_check",
|
|
28855
28858
|
sql27`${table.status} IN ('queued', 'dispatched', 'action_required', 'passed', 'failed', 'superseded', 'timed_out', 'cancelled')`
|
|
@@ -28913,7 +28916,7 @@ var orchestrationValidationEvidence = pgTable96(
|
|
|
28913
28916
|
table.attemptId,
|
|
28914
28917
|
table.evidenceDigest
|
|
28915
28918
|
),
|
|
28916
|
-
|
|
28919
|
+
index84("orchestration_validation_evidence_envelope_idx").on(table.envelopeId),
|
|
28917
28920
|
check9(
|
|
28918
28921
|
"orchestration_validation_evidence_status_check",
|
|
28919
28922
|
sql27`${table.status} IN ('passed', 'failed')`
|
|
@@ -28923,7 +28926,7 @@ var orchestrationValidationEvidence = pgTable96(
|
|
|
28923
28926
|
|
|
28924
28927
|
// src/schema/orchestration_executor_grants.ts
|
|
28925
28928
|
import { sql as sql28 } from "drizzle-orm";
|
|
28926
|
-
import { check as check10, foreignKey as foreignKey12, index as
|
|
28929
|
+
import { check as check10, foreignKey as foreignKey12, index as index85, integer as integer49, pgTable as pgTable97, text as text98, timestamp as timestamp90, unique as unique11, uniqueIndex as uniqueIndex44, uuid as uuid9, varchar as varchar71 } from "drizzle-orm/pg-core";
|
|
28927
28930
|
var EXECUTOR_GRANT_STATUSES = ["active", "revoked", "expired"];
|
|
28928
28931
|
var orchestrationExecutorGrants = pgTable97(
|
|
28929
28932
|
"orchestration_executor_grants",
|
|
@@ -28962,8 +28965,8 @@ var orchestrationExecutorGrants = pgTable97(
|
|
|
28962
28965
|
}).onDelete("cascade"),
|
|
28963
28966
|
// One live credential per installation. Two would mean two processes can each present a valid
|
|
28964
28967
|
// one, and the exclusion argument collapses before the lease layer is reached.
|
|
28965
|
-
|
|
28966
|
-
|
|
28968
|
+
uniqueIndex44("orchestration_executor_grants_one_active_per_installation").on(table.installationId).where(sql28`status = 'active'`),
|
|
28969
|
+
index85("orchestration_executor_grants_credential_idx").on(table.workspaceId, table.credentialHash).where(sql28`status = 'active'`),
|
|
28967
28970
|
check10(
|
|
28968
28971
|
"orchestration_executor_grants_status_check",
|
|
28969
28972
|
sql28`${table.status} IN ('active', 'revoked', 'expired')`
|
|
@@ -28976,7 +28979,7 @@ var orchestrationExecutorGrants = pgTable97(
|
|
|
28976
28979
|
);
|
|
28977
28980
|
|
|
28978
28981
|
// src/schema/component_presets.ts
|
|
28979
|
-
import { pgTable as pgTable98, text as text99, varchar as varchar72, timestamp as timestamp91, jsonb as jsonb57, integer as integer50, index as
|
|
28982
|
+
import { pgTable as pgTable98, text as text99, varchar as varchar72, timestamp as timestamp91, jsonb as jsonb57, integer as integer50, index as index86, uniqueIndex as uniqueIndex45 } from "drizzle-orm/pg-core";
|
|
28980
28983
|
import { relations as relations16 } from "drizzle-orm";
|
|
28981
28984
|
var componentPresets = pgTable98(
|
|
28982
28985
|
"component_presets",
|
|
@@ -28996,8 +28999,8 @@ var componentPresets = pgTable98(
|
|
|
28996
28999
|
updatedBy: text99("updated_by")
|
|
28997
29000
|
},
|
|
28998
29001
|
(t) => [
|
|
28999
|
-
|
|
29000
|
-
|
|
29002
|
+
index86("component_presets_component_position_idx").on(t.componentId, t.position, t.createdAt, t.id),
|
|
29003
|
+
uniqueIndex45("component_presets_component_slug_key").on(t.componentId, t.slug)
|
|
29001
29004
|
]
|
|
29002
29005
|
);
|
|
29003
29006
|
var componentPresetsRelations = relations16(componentPresets, ({ one }) => ({
|
|
@@ -29010,14 +29013,14 @@ var componentPresetsRelations = relations16(componentPresets, ({ one }) => ({
|
|
|
29010
29013
|
// src/schema/section_zones.ts
|
|
29011
29014
|
import {
|
|
29012
29015
|
foreignKey as foreignKey13,
|
|
29013
|
-
index as
|
|
29016
|
+
index as index87,
|
|
29014
29017
|
integer as integer51,
|
|
29015
29018
|
jsonb as jsonb58,
|
|
29016
29019
|
pgTable as pgTable99,
|
|
29017
29020
|
text as text100,
|
|
29018
29021
|
timestamp as timestamp92,
|
|
29019
29022
|
unique as unique12,
|
|
29020
|
-
uniqueIndex as
|
|
29023
|
+
uniqueIndex as uniqueIndex46,
|
|
29021
29024
|
varchar as varchar73
|
|
29022
29025
|
} from "drizzle-orm/pg-core";
|
|
29023
29026
|
import { sql as sql29 } from "drizzle-orm";
|
|
@@ -29047,9 +29050,9 @@ var sectionDefinitions = pgTable99(
|
|
|
29047
29050
|
name: "section_definitions_project_workspace_fkey"
|
|
29048
29051
|
}).onDelete("cascade").onUpdate("cascade"),
|
|
29049
29052
|
unique12("section_definitions_id_project_unique").on(table.id, table.projectId),
|
|
29050
|
-
|
|
29051
|
-
|
|
29052
|
-
|
|
29053
|
+
uniqueIndex46("section_definitions_project_api_id_unique").on(table.projectId, table.apiId),
|
|
29054
|
+
index87("section_definitions_workspace_idx").on(table.workspaceId),
|
|
29055
|
+
index87("section_definitions_project_idx").on(table.projectId)
|
|
29053
29056
|
]
|
|
29054
29057
|
);
|
|
29055
29058
|
var sectionDefinitionVersions = pgTable99(
|
|
@@ -29083,7 +29086,7 @@ var sectionDefinitionVersions = pgTable99(
|
|
|
29083
29086
|
table.version,
|
|
29084
29087
|
table.projectId
|
|
29085
29088
|
),
|
|
29086
|
-
|
|
29089
|
+
index87("section_definition_versions_project_idx").on(table.projectId)
|
|
29087
29090
|
]
|
|
29088
29091
|
);
|
|
29089
29092
|
var sectionZones = pgTable99(
|
|
@@ -29106,8 +29109,8 @@ var sectionZones = pgTable99(
|
|
|
29106
29109
|
name: "section_zones_project_workspace_fkey"
|
|
29107
29110
|
}).onDelete("cascade").onUpdate("cascade"),
|
|
29108
29111
|
unique12("section_zones_id_project_unique").on(table.id, table.projectId),
|
|
29109
|
-
|
|
29110
|
-
|
|
29112
|
+
uniqueIndex46("section_zones_schema_owner_unique").on(table.projectId, table.schemaKind, table.schemaId),
|
|
29113
|
+
index87("section_zones_workspace_idx").on(table.workspaceId)
|
|
29111
29114
|
]
|
|
29112
29115
|
);
|
|
29113
29116
|
var sectionZoneAttachments = pgTable99(
|
|
@@ -29157,8 +29160,8 @@ var sectionZoneAttachments = pgTable99(
|
|
|
29157
29160
|
],
|
|
29158
29161
|
name: "section_zone_attachments_published_version_fkey"
|
|
29159
29162
|
}).onDelete("restrict"),
|
|
29160
|
-
|
|
29161
|
-
|
|
29163
|
+
uniqueIndex46("section_zone_attachments_zone_definition_unique").on(table.zoneId, table.sectionDefinitionId),
|
|
29164
|
+
index87("section_zone_attachments_zone_position_idx").on(table.zoneId, table.position, table.id)
|
|
29162
29165
|
]
|
|
29163
29166
|
);
|
|
29164
29167
|
var sectionManifests = pgTable99(
|
|
@@ -29192,7 +29195,7 @@ var sectionManifests = pgTable99(
|
|
|
29192
29195
|
name: "section_manifests_definition_version_project_fkey"
|
|
29193
29196
|
}).onDelete("cascade"),
|
|
29194
29197
|
unique12("section_manifests_id_project_unique").on(table.id, table.projectId),
|
|
29195
|
-
|
|
29198
|
+
index87("section_manifests_definition_version_idx").on(table.sectionDefinitionId, table.sectionVersion, table.createdAt)
|
|
29196
29199
|
]
|
|
29197
29200
|
);
|
|
29198
29201
|
var sectionValidationRuns = pgTable99(
|
|
@@ -29234,7 +29237,7 @@ var sectionValidationRuns = pgTable99(
|
|
|
29234
29237
|
name: "section_validation_runs_manifest_project_fkey"
|
|
29235
29238
|
}).onDelete("restrict"),
|
|
29236
29239
|
unique12("section_validation_runs_id_project_unique").on(table.id, table.projectId),
|
|
29237
|
-
|
|
29240
|
+
index87("section_validation_runs_definition_version_idx").on(table.sectionDefinitionId, table.sectionVersion, table.createdAt)
|
|
29238
29241
|
]
|
|
29239
29242
|
);
|
|
29240
29243
|
var sectionVisualApprovals = pgTable99(
|
|
@@ -29279,7 +29282,7 @@ var sectionVisualApprovals = pgTable99(
|
|
|
29279
29282
|
foreignColumns: [sectionValidationRuns.id, sectionValidationRuns.projectId],
|
|
29280
29283
|
name: "section_visual_approvals_validation_project_fkey"
|
|
29281
29284
|
}).onDelete("restrict"),
|
|
29282
|
-
|
|
29285
|
+
index87("section_visual_approvals_definition_version_idx").on(table.sectionDefinitionId, table.sectionVersion, table.createdAt)
|
|
29283
29286
|
]
|
|
29284
29287
|
);
|
|
29285
29288
|
var sectionImplementationRequests = pgTable99(
|
|
@@ -29336,8 +29339,8 @@ var sectionImplementationRequests = pgTable99(
|
|
|
29336
29339
|
name: "section_implementation_requests_validation_project_fkey"
|
|
29337
29340
|
}).onDelete("restrict"),
|
|
29338
29341
|
unique12("section_implementation_requests_id_project_unique").on(table.id, table.projectId),
|
|
29339
|
-
|
|
29340
|
-
|
|
29342
|
+
uniqueIndex46("section_implementation_requests_one_active_unique").on(table.projectId, table.sectionDefinitionId, table.sectionVersion, table.schemaHash).where(sql29`${table.status} IN ('queued', 'dispatching', 'dispatched', 'running')`),
|
|
29343
|
+
index87("section_implementation_requests_project_created_idx").on(table.projectId, table.createdAt)
|
|
29341
29344
|
]
|
|
29342
29345
|
);
|
|
29343
29346
|
var sectionZoneReleases = pgTable99(
|
|
@@ -29364,12 +29367,12 @@ var sectionZoneReleases = pgTable99(
|
|
|
29364
29367
|
name: "section_zone_releases_zone_project_fkey"
|
|
29365
29368
|
}).onDelete("cascade"),
|
|
29366
29369
|
unique12("section_zone_releases_zone_revision_unique").on(table.zoneId, table.revision),
|
|
29367
|
-
|
|
29370
|
+
index87("section_zone_releases_project_published_idx").on(table.projectId, table.publishedAt)
|
|
29368
29371
|
]
|
|
29369
29372
|
);
|
|
29370
29373
|
|
|
29371
29374
|
// src/schema/content_locks.ts
|
|
29372
|
-
import { check as check11, index as
|
|
29375
|
+
import { check as check11, index as index88, jsonb as jsonb59, pgTable as pgTable100, text as text101, timestamp as timestamp93 } from "drizzle-orm/pg-core";
|
|
29373
29376
|
import { sql as sql30 } from "drizzle-orm";
|
|
29374
29377
|
var CONTENT_LOCK_TARGET_KINDS = [
|
|
29375
29378
|
"page",
|
|
@@ -29399,9 +29402,9 @@ var contentLocks = pgTable100(
|
|
|
29399
29402
|
releasedAt: timestamp93("released_at")
|
|
29400
29403
|
},
|
|
29401
29404
|
(table) => [
|
|
29402
|
-
|
|
29403
|
-
|
|
29404
|
-
|
|
29405
|
+
index88("content_locks_workspace_idx").on(table.workspaceId),
|
|
29406
|
+
index88("content_locks_project_idx").on(table.projectId),
|
|
29407
|
+
index88("content_locks_target_idx").on(table.targetKind, table.targetId).where(sql30`${table.releasedAt} IS NULL`),
|
|
29405
29408
|
check11("content_locks_target_kind_check", sql30`${table.targetKind} IN ('page','content_entry','singleton_entry','component_definition')`),
|
|
29406
29409
|
check11("content_locks_mode_check", sql30`${table.mode} IN ('all','agents')`)
|
|
29407
29410
|
// `content_locks_shape_check` lives in migration 0192 ONLY: it calls
|
|
@@ -29421,8 +29424,8 @@ import {
|
|
|
29421
29424
|
text as text102,
|
|
29422
29425
|
varchar as varchar74,
|
|
29423
29426
|
timestamp as timestamp94,
|
|
29424
|
-
index as
|
|
29425
|
-
uniqueIndex as
|
|
29427
|
+
index as index89,
|
|
29428
|
+
uniqueIndex as uniqueIndex47
|
|
29426
29429
|
} from "drizzle-orm/pg-core";
|
|
29427
29430
|
import { sql as sql31 } from "drizzle-orm";
|
|
29428
29431
|
var projectTransfers = pgTable101(
|
|
@@ -29460,19 +29463,19 @@ var projectTransfers = pgTable101(
|
|
|
29460
29463
|
(table) => [
|
|
29461
29464
|
// At most one OPEN transfer per project. Partial-unique so completed/declined/
|
|
29462
29465
|
// cancelled/expired/failed rows never wedge a re-initiation.
|
|
29463
|
-
|
|
29466
|
+
uniqueIndex47("project_transfers_one_pending_idx").on(table.projectId).where(sql31`${table.status} = 'pending'`),
|
|
29464
29467
|
// Recipient inbox lookup (GET /me/transfers by email + status).
|
|
29465
|
-
|
|
29468
|
+
index89("project_transfers_recipient_idx").on(
|
|
29466
29469
|
table.recipientEmail,
|
|
29467
29470
|
table.status
|
|
29468
29471
|
),
|
|
29469
29472
|
// Source-side list (GET /projects/:id/transfers) + cancel.
|
|
29470
|
-
|
|
29471
|
-
|
|
29473
|
+
index89("project_transfers_from_ws_idx").on(table.fromWorkspaceId),
|
|
29474
|
+
index89("project_transfers_project_idx").on(table.projectId),
|
|
29472
29475
|
// Magic-link resolution.
|
|
29473
|
-
|
|
29476
|
+
uniqueIndex47("project_transfers_token_idx").on(table.token),
|
|
29474
29477
|
// Expiry sweep — only pending rows are ever candidates.
|
|
29475
|
-
|
|
29478
|
+
index89("project_transfers_expires_idx").on(table.expiresAt).where(sql31`${table.status} = 'pending'`)
|
|
29476
29479
|
]
|
|
29477
29480
|
);
|
|
29478
29481
|
|
|
@@ -29485,7 +29488,7 @@ import {
|
|
|
29485
29488
|
bigint as bigint7,
|
|
29486
29489
|
jsonb as jsonb60,
|
|
29487
29490
|
timestamp as timestamp95,
|
|
29488
|
-
index as
|
|
29491
|
+
index as index90
|
|
29489
29492
|
} from "drizzle-orm/pg-core";
|
|
29490
29493
|
var FULL_BACKUP_SCOPE = {
|
|
29491
29494
|
content: true,
|
|
@@ -29527,8 +29530,8 @@ var backups = pgTable102(
|
|
|
29527
29530
|
deletedAt: timestamp95("deleted_at")
|
|
29528
29531
|
},
|
|
29529
29532
|
(t) => [
|
|
29530
|
-
|
|
29531
|
-
|
|
29533
|
+
index90("backups_project_idx").on(t.projectId, t.createdAt),
|
|
29534
|
+
index90("backups_workspace_idx").on(t.workspaceId)
|
|
29532
29535
|
]
|
|
29533
29536
|
);
|
|
29534
29537
|
|
|
@@ -29540,7 +29543,7 @@ import {
|
|
|
29540
29543
|
integer as integer53,
|
|
29541
29544
|
jsonb as jsonb61,
|
|
29542
29545
|
timestamp as timestamp96,
|
|
29543
|
-
index as
|
|
29546
|
+
index as index91
|
|
29544
29547
|
} from "drizzle-orm/pg-core";
|
|
29545
29548
|
var backupJobs = pgTable103(
|
|
29546
29549
|
"backup_jobs",
|
|
@@ -29563,13 +29566,13 @@ var backupJobs = pgTable103(
|
|
|
29563
29566
|
updatedAt: timestamp96("updated_at").notNull().defaultNow()
|
|
29564
29567
|
},
|
|
29565
29568
|
(t) => [
|
|
29566
|
-
|
|
29567
|
-
|
|
29569
|
+
index91("backup_jobs_drain_idx").on(t.status, t.createdAt),
|
|
29570
|
+
index91("backup_jobs_project_idx").on(t.projectId)
|
|
29568
29571
|
]
|
|
29569
29572
|
);
|
|
29570
29573
|
|
|
29571
29574
|
// src/schema/clone_links.ts
|
|
29572
|
-
import { pgTable as pgTable104, text as text105, boolean as boolean31, jsonb as jsonb62, timestamp as timestamp97, index as
|
|
29575
|
+
import { pgTable as pgTable104, text as text105, boolean as boolean31, jsonb as jsonb62, timestamp as timestamp97, index as index92 } from "drizzle-orm/pg-core";
|
|
29573
29576
|
var cloneLinks = pgTable104(
|
|
29574
29577
|
"clone_links",
|
|
29575
29578
|
{
|
|
@@ -29591,13 +29594,13 @@ var cloneLinks = pgTable104(
|
|
|
29591
29594
|
// set when the link is rotated/disabled
|
|
29592
29595
|
},
|
|
29593
29596
|
(t) => [
|
|
29594
|
-
|
|
29595
|
-
|
|
29597
|
+
index92("clone_links_project_idx").on(t.projectId),
|
|
29598
|
+
index92("clone_links_workspace_idx").on(t.workspaceId)
|
|
29596
29599
|
]
|
|
29597
29600
|
);
|
|
29598
29601
|
|
|
29599
29602
|
// src/schema/clone_jobs.ts
|
|
29600
|
-
import { pgTable as pgTable105, text as text106, varchar as varchar77, integer as integer54, jsonb as jsonb63, timestamp as timestamp98, index as
|
|
29603
|
+
import { pgTable as pgTable105, text as text106, varchar as varchar77, integer as integer54, jsonb as jsonb63, timestamp as timestamp98, index as index93, uniqueIndex as uniqueIndex48 } from "drizzle-orm/pg-core";
|
|
29601
29604
|
import { sql as sql32 } from "drizzle-orm";
|
|
29602
29605
|
var cloneJobs = pgTable105(
|
|
29603
29606
|
"clone_jobs",
|
|
@@ -29628,11 +29631,11 @@ var cloneJobs = pgTable105(
|
|
|
29628
29631
|
updatedAt: timestamp98("updated_at").notNull().defaultNow()
|
|
29629
29632
|
},
|
|
29630
29633
|
(t) => [
|
|
29631
|
-
|
|
29632
|
-
|
|
29634
|
+
index93("clone_jobs_drain_idx").on(t.status, t.createdAt),
|
|
29635
|
+
index93("clone_jobs_workspace_idx").on(t.workspaceId),
|
|
29633
29636
|
// One unfinished hybrid→headless switch per source (0343). The route maps its 23505 to
|
|
29634
29637
|
// SWITCH_ALREADY_PENDING.
|
|
29635
|
-
|
|
29638
|
+
uniqueIndex48("clone_jobs_mode_switch_active_uniq").on(t.sourceProjectId).where(sql32`${t.purpose} = 'mode_switch' AND ${t.status} IN ('pending', 'working')`)
|
|
29636
29639
|
]
|
|
29637
29640
|
);
|
|
29638
29641
|
|
|
@@ -29643,8 +29646,8 @@ import {
|
|
|
29643
29646
|
text as text107,
|
|
29644
29647
|
varchar as varchar78,
|
|
29645
29648
|
timestamp as timestamp99,
|
|
29646
|
-
index as
|
|
29647
|
-
uniqueIndex as
|
|
29649
|
+
index as index94,
|
|
29650
|
+
uniqueIndex as uniqueIndex49
|
|
29648
29651
|
} from "drizzle-orm/pg-core";
|
|
29649
29652
|
import { sql as sql33 } from "drizzle-orm";
|
|
29650
29653
|
var projectBranches = pgTable106(
|
|
@@ -29664,8 +29667,8 @@ var projectBranches = pgTable106(
|
|
|
29664
29667
|
...auditColumns
|
|
29665
29668
|
},
|
|
29666
29669
|
(t) => [
|
|
29667
|
-
|
|
29668
|
-
|
|
29670
|
+
index94("project_branches_project_idx").on(t.projectId),
|
|
29671
|
+
uniqueIndex49("project_branches_project_slug_open_idx").on(t.projectId, t.slug).where(sql33`${t.status} = 'open'`)
|
|
29669
29672
|
]
|
|
29670
29673
|
);
|
|
29671
29674
|
var branchRowSyncs = pgTable106(
|
|
@@ -29680,12 +29683,12 @@ var branchRowSyncs = pgTable106(
|
|
|
29680
29683
|
},
|
|
29681
29684
|
(t) => [
|
|
29682
29685
|
primaryKey10({ columns: [t.branchId, t.kind, t.parentRowId] }),
|
|
29683
|
-
|
|
29686
|
+
index94("branch_row_syncs_project_idx").on(t.projectId)
|
|
29684
29687
|
]
|
|
29685
29688
|
);
|
|
29686
29689
|
|
|
29687
29690
|
// src/schema/branch_preview_share.ts
|
|
29688
|
-
import { pgTable as pgTable107, text as text108, boolean as boolean32, timestamp as timestamp100, index as
|
|
29691
|
+
import { pgTable as pgTable107, text as text108, boolean as boolean32, timestamp as timestamp100, index as index95, uniqueIndex as uniqueIndex50 } from "drizzle-orm/pg-core";
|
|
29689
29692
|
var branchPreviewShares = pgTable107(
|
|
29690
29693
|
"branch_preview_shares",
|
|
29691
29694
|
{
|
|
@@ -29700,10 +29703,10 @@ var branchPreviewShares = pgTable107(
|
|
|
29700
29703
|
updatedAt: timestamp100("updated_at").notNull().defaultNow()
|
|
29701
29704
|
},
|
|
29702
29705
|
(t) => [
|
|
29703
|
-
|
|
29704
|
-
|
|
29705
|
-
|
|
29706
|
-
|
|
29706
|
+
uniqueIndex50("branch_preview_shares_branch_idx").on(t.branchId),
|
|
29707
|
+
uniqueIndex50("branch_preview_shares_active_token_idx").on(t.publicToken),
|
|
29708
|
+
index95("branch_preview_shares_project_idx").on(t.projectId),
|
|
29709
|
+
index95("branch_preview_shares_workspace_idx").on(t.workspaceId)
|
|
29707
29710
|
]
|
|
29708
29711
|
);
|
|
29709
29712
|
var branchPreviewGrants = pgTable107(
|
|
@@ -29718,13 +29721,13 @@ var branchPreviewGrants = pgTable107(
|
|
|
29718
29721
|
createdAt: timestamp100("created_at").notNull().defaultNow()
|
|
29719
29722
|
},
|
|
29720
29723
|
(t) => [
|
|
29721
|
-
|
|
29722
|
-
|
|
29724
|
+
uniqueIndex50("branch_preview_grants_branch_email_idx").on(t.branchId, t.email),
|
|
29725
|
+
index95("branch_preview_grants_project_idx").on(t.projectId)
|
|
29723
29726
|
]
|
|
29724
29727
|
);
|
|
29725
29728
|
|
|
29726
29729
|
// src/schema/share_links.ts
|
|
29727
|
-
import { pgTable as pgTable108, text as text109, boolean as boolean33, timestamp as timestamp101, index as
|
|
29730
|
+
import { pgTable as pgTable108, text as text109, boolean as boolean33, timestamp as timestamp101, index as index96 } from "drizzle-orm/pg-core";
|
|
29728
29731
|
var shareLinks = pgTable108(
|
|
29729
29732
|
"share_links",
|
|
29730
29733
|
{
|
|
@@ -29745,8 +29748,8 @@ var shareLinks = pgTable108(
|
|
|
29745
29748
|
// set when the link is disabled
|
|
29746
29749
|
},
|
|
29747
29750
|
(t) => [
|
|
29748
|
-
|
|
29749
|
-
|
|
29751
|
+
index96("share_links_project_idx").on(t.projectId),
|
|
29752
|
+
index96("share_links_workspace_idx").on(t.workspaceId)
|
|
29750
29753
|
]
|
|
29751
29754
|
);
|
|
29752
29755
|
|
|
@@ -29758,8 +29761,8 @@ import {
|
|
|
29758
29761
|
timestamp as timestamp102,
|
|
29759
29762
|
jsonb as jsonb64,
|
|
29760
29763
|
integer as integer55,
|
|
29761
|
-
index as
|
|
29762
|
-
uniqueIndex as
|
|
29764
|
+
index as index97,
|
|
29765
|
+
uniqueIndex as uniqueIndex51
|
|
29763
29766
|
} from "drizzle-orm/pg-core";
|
|
29764
29767
|
import { relations as relations17 } from "drizzle-orm/relations";
|
|
29765
29768
|
import { sql as sql34 } from "drizzle-orm";
|
|
@@ -29797,12 +29800,12 @@ var templates = pgTable109(
|
|
|
29797
29800
|
// soft-delete
|
|
29798
29801
|
},
|
|
29799
29802
|
(table) => [
|
|
29800
|
-
|
|
29803
|
+
index97("templates_workspace_idx").on(table.workspaceId),
|
|
29801
29804
|
// Partial: only live rows. A soft-deleted template frees its slug (mirrors
|
|
29802
29805
|
// components_ws_proj_slug_idx / migration 0114).
|
|
29803
|
-
|
|
29806
|
+
uniqueIndex51("templates_ws_slug_idx").on(table.workspaceId, table.slug).where(sql34`${table.deletedAt} IS NULL`),
|
|
29804
29807
|
// Public gallery scan (created_at DESC over live public rows).
|
|
29805
|
-
|
|
29808
|
+
index97("templates_public_idx").on(table.visibility).where(sql34`${table.visibility} = 'public' AND ${table.deletedAt} IS NULL`)
|
|
29806
29809
|
]
|
|
29807
29810
|
);
|
|
29808
29811
|
var templatesRelations = relations17(templates, ({ one }) => ({
|
|
@@ -29819,7 +29822,7 @@ import {
|
|
|
29819
29822
|
varchar as varchar80,
|
|
29820
29823
|
integer as integer56,
|
|
29821
29824
|
timestamp as timestamp103,
|
|
29822
|
-
index as
|
|
29825
|
+
index as index98
|
|
29823
29826
|
} from "drizzle-orm/pg-core";
|
|
29824
29827
|
var paymentRecords = pgTable110(
|
|
29825
29828
|
"payment_records",
|
|
@@ -29839,7 +29842,7 @@ var paymentRecords = pgTable110(
|
|
|
29839
29842
|
createdAt: timestamp103("created_at").notNull().defaultNow()
|
|
29840
29843
|
},
|
|
29841
29844
|
(table) => [
|
|
29842
|
-
|
|
29845
|
+
index98("payment_records_workspace_idx").on(table.workspaceId, table.createdAt)
|
|
29843
29846
|
]
|
|
29844
29847
|
);
|
|
29845
29848
|
|
|
@@ -29848,7 +29851,7 @@ import {
|
|
|
29848
29851
|
pgTable as pgTable111,
|
|
29849
29852
|
text as text112,
|
|
29850
29853
|
timestamp as timestamp104,
|
|
29851
|
-
index as
|
|
29854
|
+
index as index99
|
|
29852
29855
|
} from "drizzle-orm/pg-core";
|
|
29853
29856
|
var planChanges = pgTable111(
|
|
29854
29857
|
"plan_changes",
|
|
@@ -29867,12 +29870,12 @@ var planChanges = pgTable111(
|
|
|
29867
29870
|
createdAt: timestamp104("created_at").notNull().defaultNow()
|
|
29868
29871
|
},
|
|
29869
29872
|
(table) => [
|
|
29870
|
-
|
|
29873
|
+
index99("plan_changes_workspace_idx").on(table.workspaceId, table.createdAt)
|
|
29871
29874
|
]
|
|
29872
29875
|
);
|
|
29873
29876
|
|
|
29874
29877
|
// src/schema/billing_addons.ts
|
|
29875
|
-
import { pgTable as pgTable112, text as text113, varchar as varchar81, integer as integer57, boolean as boolean34, jsonb as jsonb65, index as
|
|
29878
|
+
import { pgTable as pgTable112, text as text113, varchar as varchar81, integer as integer57, boolean as boolean34, jsonb as jsonb65, index as index100 } from "drizzle-orm/pg-core";
|
|
29876
29879
|
var billingAddons = pgTable112(
|
|
29877
29880
|
"billing_addons",
|
|
29878
29881
|
{
|
|
@@ -29891,11 +29894,11 @@ var billingAddons = pgTable112(
|
|
|
29891
29894
|
// seats/localization/AB = true; credit packs = false
|
|
29892
29895
|
metadata: jsonb65("metadata").$type().default({})
|
|
29893
29896
|
},
|
|
29894
|
-
(t) => [
|
|
29897
|
+
(t) => [index100("billing_addons_kind_idx").on(t.kind)]
|
|
29895
29898
|
);
|
|
29896
29899
|
|
|
29897
29900
|
// src/schema/billing_customers.ts
|
|
29898
|
-
import { pgTable as pgTable113, text as text114, varchar as varchar82, timestamp as timestamp105, uniqueIndex as
|
|
29901
|
+
import { pgTable as pgTable113, text as text114, varchar as varchar82, timestamp as timestamp105, uniqueIndex as uniqueIndex52 } from "drizzle-orm/pg-core";
|
|
29899
29902
|
var billingCustomers = pgTable113(
|
|
29900
29903
|
"billing_customers",
|
|
29901
29904
|
{
|
|
@@ -29909,13 +29912,13 @@ var billingCustomers = pgTable113(
|
|
|
29909
29912
|
updatedAt: timestamp105("updated_at").notNull().defaultNow()
|
|
29910
29913
|
},
|
|
29911
29914
|
(t) => [
|
|
29912
|
-
|
|
29913
|
-
|
|
29915
|
+
uniqueIndex52("billing_customers_workspace_idx").on(t.workspaceId),
|
|
29916
|
+
uniqueIndex52("billing_customers_dodo_idx").on(t.dodoCustomerId)
|
|
29914
29917
|
]
|
|
29915
29918
|
);
|
|
29916
29919
|
|
|
29917
29920
|
// src/schema/subscriptions.ts
|
|
29918
|
-
import { pgTable as pgTable114, text as text115, varchar as varchar83, boolean as boolean35, timestamp as timestamp106, index as
|
|
29921
|
+
import { pgTable as pgTable114, text as text115, varchar as varchar83, boolean as boolean35, timestamp as timestamp106, index as index101, uniqueIndex as uniqueIndex53 } from "drizzle-orm/pg-core";
|
|
29919
29922
|
import { sql as sql35 } from "drizzle-orm";
|
|
29920
29923
|
var subscriptions = pgTable114(
|
|
29921
29924
|
"subscriptions",
|
|
@@ -29942,17 +29945,17 @@ var subscriptions = pgTable114(
|
|
|
29942
29945
|
updatedAt: timestamp106("updated_at").notNull().defaultNow()
|
|
29943
29946
|
},
|
|
29944
29947
|
(t) => [
|
|
29945
|
-
|
|
29946
|
-
|
|
29948
|
+
index101("subscriptions_workspace_idx").on(t.workspaceId),
|
|
29949
|
+
uniqueIndex53("subscriptions_dodo_idx").on(t.dodoSubscriptionId).where(sql35`${t.dodoSubscriptionId} IS NOT NULL`),
|
|
29947
29950
|
// At most one workspace-level subscription per workspace.
|
|
29948
|
-
|
|
29951
|
+
uniqueIndex53("subscriptions_workspace_plan_unique").on(t.workspaceId).where(sql35`${t.projectId} IS NULL`),
|
|
29949
29952
|
// At most one subscription per site.
|
|
29950
|
-
|
|
29953
|
+
uniqueIndex53("subscriptions_project_unique").on(t.projectId).where(sql35`${t.projectId} IS NOT NULL`)
|
|
29951
29954
|
]
|
|
29952
29955
|
);
|
|
29953
29956
|
|
|
29954
29957
|
// src/schema/subscription_addons.ts
|
|
29955
|
-
import { pgTable as pgTable115, text as text116, varchar as varchar84, integer as integer58, timestamp as timestamp107, index as
|
|
29958
|
+
import { pgTable as pgTable115, text as text116, varchar as varchar84, integer as integer58, timestamp as timestamp107, index as index102, uniqueIndex as uniqueIndex54 } from "drizzle-orm/pg-core";
|
|
29956
29959
|
import { sql as sql36 } from "drizzle-orm";
|
|
29957
29960
|
var subscriptionAddons = pgTable115(
|
|
29958
29961
|
"subscription_addons",
|
|
@@ -29972,13 +29975,13 @@ var subscriptionAddons = pgTable115(
|
|
|
29972
29975
|
updatedAt: timestamp107("updated_at").notNull().defaultNow()
|
|
29973
29976
|
},
|
|
29974
29977
|
(t) => [
|
|
29975
|
-
|
|
29976
|
-
|
|
29978
|
+
index102("subscription_addons_workspace_idx").on(t.workspaceId),
|
|
29979
|
+
uniqueIndex54("subscription_addons_dodo_idx").on(t.dodoSubscriptionId).where(sql36`${t.dodoSubscriptionId} IS NOT NULL`)
|
|
29977
29980
|
]
|
|
29978
29981
|
);
|
|
29979
29982
|
|
|
29980
29983
|
// src/schema/billing_alerts.ts
|
|
29981
|
-
import { pgTable as pgTable116, text as text117, varchar as varchar85, timestamp as timestamp108, index as
|
|
29984
|
+
import { pgTable as pgTable116, text as text117, varchar as varchar85, timestamp as timestamp108, index as index103, uniqueIndex as uniqueIndex55 } from "drizzle-orm/pg-core";
|
|
29982
29985
|
var billingAlerts = pgTable116(
|
|
29983
29986
|
"billing_alerts",
|
|
29984
29987
|
{
|
|
@@ -29998,13 +30001,13 @@ var billingAlerts = pgTable116(
|
|
|
29998
30001
|
sentAt: timestamp108("sent_at", { withTimezone: true }).notNull().defaultNow()
|
|
29999
30002
|
},
|
|
30000
30003
|
(t) => [
|
|
30001
|
-
|
|
30002
|
-
|
|
30004
|
+
uniqueIndex55("billing_alerts_dedupe_idx").on(t.dedupeKey),
|
|
30005
|
+
index103("billing_alerts_workspace_idx").on(t.workspaceId, t.sentAt)
|
|
30003
30006
|
]
|
|
30004
30007
|
);
|
|
30005
30008
|
|
|
30006
30009
|
// src/schema/ai_credit_ledger.ts
|
|
30007
|
-
import { pgTable as pgTable117, text as text118, varchar as varchar86, integer as integer59, timestamp as timestamp109, index as
|
|
30010
|
+
import { pgTable as pgTable117, text as text118, varchar as varchar86, integer as integer59, timestamp as timestamp109, index as index104, uniqueIndex as uniqueIndex56 } from "drizzle-orm/pg-core";
|
|
30008
30011
|
import { sql as sql37 } from "drizzle-orm";
|
|
30009
30012
|
var aiCreditLedger = pgTable117(
|
|
30010
30013
|
"ai_credit_ledger",
|
|
@@ -30023,8 +30026,8 @@ var aiCreditLedger = pgTable117(
|
|
|
30023
30026
|
createdAt: timestamp109("created_at").notNull().defaultNow()
|
|
30024
30027
|
},
|
|
30025
30028
|
(t) => [
|
|
30026
|
-
|
|
30027
|
-
|
|
30029
|
+
index104("ai_credit_ledger_workspace_idx").on(t.workspaceId, t.createdAt),
|
|
30030
|
+
uniqueIndex56("ai_credit_ledger_custom_agent_run_unique").on(t.note).where(sql37`${t.reason} = 'consume' AND ${t.note} LIKE 'custom-agent-run:%'`)
|
|
30028
30031
|
]
|
|
30029
30032
|
);
|
|
30030
30033
|
|
|
@@ -30036,7 +30039,7 @@ import {
|
|
|
30036
30039
|
timestamp as timestamp110,
|
|
30037
30040
|
boolean as boolean36,
|
|
30038
30041
|
jsonb as jsonb66,
|
|
30039
|
-
index as
|
|
30042
|
+
index as index105
|
|
30040
30043
|
} from "drizzle-orm/pg-core";
|
|
30041
30044
|
var supportTickets = pgTable118(
|
|
30042
30045
|
"support_tickets",
|
|
@@ -30076,10 +30079,10 @@ var supportTickets = pgTable118(
|
|
|
30076
30079
|
updatedAt: timestamp110("updated_at").notNull().defaultNow()
|
|
30077
30080
|
},
|
|
30078
30081
|
(table) => [
|
|
30079
|
-
|
|
30080
|
-
|
|
30081
|
-
|
|
30082
|
-
|
|
30082
|
+
index105("support_tickets_status_idx").on(table.status, table.updatedAt),
|
|
30083
|
+
index105("support_tickets_workspace_idx").on(table.workspaceId),
|
|
30084
|
+
index105("support_tickets_user_idx").on(table.userId),
|
|
30085
|
+
index105("support_tickets_channel_idx").on(table.channel, table.updatedAt)
|
|
30083
30086
|
]
|
|
30084
30087
|
);
|
|
30085
30088
|
var supportTicketMessages = pgTable118(
|
|
@@ -30106,7 +30109,7 @@ var supportTicketMessages = pgTable118(
|
|
|
30106
30109
|
createdAt: timestamp110("created_at").notNull().defaultNow()
|
|
30107
30110
|
},
|
|
30108
30111
|
(table) => [
|
|
30109
|
-
|
|
30112
|
+
index105("support_ticket_messages_ticket_idx").on(table.ticketId, table.createdAt)
|
|
30110
30113
|
]
|
|
30111
30114
|
);
|
|
30112
30115
|
|
|
@@ -30117,7 +30120,7 @@ import {
|
|
|
30117
30120
|
varchar as varchar88,
|
|
30118
30121
|
jsonb as jsonb67,
|
|
30119
30122
|
timestamp as timestamp111,
|
|
30120
|
-
index as
|
|
30123
|
+
index as index106
|
|
30121
30124
|
} from "drizzle-orm/pg-core";
|
|
30122
30125
|
var adminActionLogs = pgTable119(
|
|
30123
30126
|
"admin_action_logs",
|
|
@@ -30141,13 +30144,13 @@ var adminActionLogs = pgTable119(
|
|
|
30141
30144
|
createdAt: timestamp111("created_at").notNull().defaultNow()
|
|
30142
30145
|
},
|
|
30143
30146
|
(table) => [
|
|
30144
|
-
|
|
30145
|
-
|
|
30147
|
+
index106("admin_action_logs_created_idx").on(table.createdAt),
|
|
30148
|
+
index106("admin_action_logs_action_idx").on(table.action, table.createdAt)
|
|
30146
30149
|
]
|
|
30147
30150
|
);
|
|
30148
30151
|
|
|
30149
30152
|
// src/schema/admin_notes.ts
|
|
30150
|
-
import { pgTable as pgTable120, text as text121, varchar as varchar89, boolean as boolean37, timestamp as timestamp112, index as
|
|
30153
|
+
import { pgTable as pgTable120, text as text121, varchar as varchar89, boolean as boolean37, timestamp as timestamp112, index as index107 } from "drizzle-orm/pg-core";
|
|
30151
30154
|
var adminNotes = pgTable120(
|
|
30152
30155
|
"admin_notes",
|
|
30153
30156
|
{
|
|
@@ -30167,12 +30170,12 @@ var adminNotes = pgTable120(
|
|
|
30167
30170
|
},
|
|
30168
30171
|
(t) => [
|
|
30169
30172
|
// Pinned first, then newest — the exact order the tab renders.
|
|
30170
|
-
|
|
30173
|
+
index107("admin_notes_target_idx").on(t.targetType, t.targetId, t.pinned, t.createdAt)
|
|
30171
30174
|
]
|
|
30172
30175
|
);
|
|
30173
30176
|
|
|
30174
30177
|
// src/schema/admin_agent_sessions.ts
|
|
30175
|
-
import { pgTable as pgTable121, text as text122, varchar as varchar90, doublePrecision as doublePrecision2, timestamp as timestamp113, index as
|
|
30178
|
+
import { pgTable as pgTable121, text as text122, varchar as varchar90, doublePrecision as doublePrecision2, timestamp as timestamp113, index as index108 } from "drizzle-orm/pg-core";
|
|
30176
30179
|
var adminAgentSessions = pgTable121(
|
|
30177
30180
|
"admin_agent_sessions",
|
|
30178
30181
|
{
|
|
@@ -30189,11 +30192,11 @@ var adminAgentSessions = pgTable121(
|
|
|
30189
30192
|
updatedAt: timestamp113("updated_at").notNull().defaultNow(),
|
|
30190
30193
|
lastActiveAt: timestamp113("last_active_at").notNull().defaultNow()
|
|
30191
30194
|
},
|
|
30192
|
-
(t) => [
|
|
30195
|
+
(t) => [index108("admin_agent_sessions_actor_idx").on(t.actorId, t.lastActiveAt)]
|
|
30193
30196
|
);
|
|
30194
30197
|
|
|
30195
30198
|
// src/schema/crm_deals.ts
|
|
30196
|
-
import { pgTable as pgTable122, text as text123, varchar as varchar91, integer as integer60, timestamp as timestamp114, index as
|
|
30199
|
+
import { pgTable as pgTable122, text as text123, varchar as varchar91, integer as integer60, timestamp as timestamp114, index as index109, unique as unique13 } from "drizzle-orm/pg-core";
|
|
30197
30200
|
var CRM_STAGES = [
|
|
30198
30201
|
"qualified",
|
|
30199
30202
|
"conversation",
|
|
@@ -30221,8 +30224,8 @@ var crmDeals = pgTable122(
|
|
|
30221
30224
|
},
|
|
30222
30225
|
(t) => [
|
|
30223
30226
|
unique13("crm_deals_workspace_id_key").on(t.workspaceId),
|
|
30224
|
-
|
|
30225
|
-
|
|
30227
|
+
index109("crm_deals_stage_idx").on(t.stage, t.lastTouchAt),
|
|
30228
|
+
index109("crm_deals_owner_idx").on(t.ownerId)
|
|
30226
30229
|
]
|
|
30227
30230
|
);
|
|
30228
30231
|
|
|
@@ -30232,8 +30235,8 @@ import {
|
|
|
30232
30235
|
text as text124,
|
|
30233
30236
|
varchar as varchar92,
|
|
30234
30237
|
timestamp as timestamp115,
|
|
30235
|
-
index as
|
|
30236
|
-
uniqueIndex as
|
|
30238
|
+
index as index110,
|
|
30239
|
+
uniqueIndex as uniqueIndex57
|
|
30237
30240
|
} from "drizzle-orm/pg-core";
|
|
30238
30241
|
var ENV_VAR_SCOPES = ["production", "preview", "development"];
|
|
30239
30242
|
var projectEnvVars = pgTable123(
|
|
@@ -30256,17 +30259,17 @@ var projectEnvVars = pgTable123(
|
|
|
30256
30259
|
},
|
|
30257
30260
|
(table) => [
|
|
30258
30261
|
// One value per key per scope — the same key MAY exist in production and preview.
|
|
30259
|
-
|
|
30262
|
+
uniqueIndex57("project_env_vars_project_key_scope_idx").on(
|
|
30260
30263
|
table.projectId,
|
|
30261
30264
|
table.key,
|
|
30262
30265
|
table.scope
|
|
30263
30266
|
),
|
|
30264
|
-
|
|
30267
|
+
index110("project_env_vars_project_idx").on(table.projectId)
|
|
30265
30268
|
]
|
|
30266
30269
|
);
|
|
30267
30270
|
|
|
30268
30271
|
// src/schema/mcp_connections.ts
|
|
30269
|
-
import { pgTable as pgTable124, text as text125, varchar as varchar93, jsonb as jsonb68, timestamp as timestamp116, index as
|
|
30272
|
+
import { pgTable as pgTable124, text as text125, varchar as varchar93, jsonb as jsonb68, timestamp as timestamp116, index as index111, uniqueIndex as uniqueIndex58 } from "drizzle-orm/pg-core";
|
|
30270
30273
|
import { sql as sql38 } from "drizzle-orm";
|
|
30271
30274
|
var mcpConnections = pgTable124(
|
|
30272
30275
|
"mcp_connections",
|
|
@@ -30326,11 +30329,11 @@ var mcpConnections = pgTable124(
|
|
|
30326
30329
|
...softDeleteColumn
|
|
30327
30330
|
},
|
|
30328
30331
|
(t) => [
|
|
30329
|
-
|
|
30330
|
-
|
|
30332
|
+
index111("mcp_connections_workspace_idx").on(t.workspaceId),
|
|
30333
|
+
index111("mcp_connections_project_idx").on(t.projectId),
|
|
30331
30334
|
// Reconnecting a catalog provider UPDATEs rather than accumulating a second live credential.
|
|
30332
30335
|
// Custom connectors are excluded: a project may legitimately add many distinct MCP servers.
|
|
30333
|
-
|
|
30336
|
+
uniqueIndex58("mcp_connections_project_provider_unique").on(t.projectId, t.providerSlug).where(sql38`deleted_at IS NULL AND provider_slug <> 'custom'`)
|
|
30334
30337
|
]
|
|
30335
30338
|
);
|
|
30336
30339
|
|
|
@@ -30342,7 +30345,7 @@ import {
|
|
|
30342
30345
|
boolean as boolean38,
|
|
30343
30346
|
jsonb as jsonb69,
|
|
30344
30347
|
integer as integer61,
|
|
30345
|
-
uniqueIndex as
|
|
30348
|
+
uniqueIndex as uniqueIndex59
|
|
30346
30349
|
} from "drizzle-orm/pg-core";
|
|
30347
30350
|
var crmConnections = pgTable125(
|
|
30348
30351
|
"crm_connections",
|
|
@@ -30362,7 +30365,7 @@ var crmConnections = pgTable125(
|
|
|
30362
30365
|
updatedAt: timestamp117("updated_at").notNull().defaultNow()
|
|
30363
30366
|
},
|
|
30364
30367
|
(t) => [
|
|
30365
|
-
|
|
30368
|
+
uniqueIndex59("crm_connection_account_uq").on(
|
|
30366
30369
|
t.workspaceId,
|
|
30367
30370
|
t.provider,
|
|
30368
30371
|
t.accountId
|
|
@@ -30400,7 +30403,7 @@ var formIntegrationDeliveries = pgTable125(
|
|
|
30400
30403
|
updatedAt: timestamp117("updated_at").notNull().defaultNow()
|
|
30401
30404
|
},
|
|
30402
30405
|
(t) => [
|
|
30403
|
-
|
|
30406
|
+
uniqueIndex59("crm_delivery_event_uq").on(
|
|
30404
30407
|
t.workspaceId,
|
|
30405
30408
|
t.eventId,
|
|
30406
30409
|
t.integrationId
|
|
@@ -30409,7 +30412,7 @@ var formIntegrationDeliveries = pgTable125(
|
|
|
30409
30412
|
);
|
|
30410
30413
|
|
|
30411
30414
|
// src/schema/platform_incidents.ts
|
|
30412
|
-
import { check as check12, integer as integer62, pgTable as pgTable126, smallint as smallint3, text as text127, timestamp as timestamp118, index as
|
|
30415
|
+
import { check as check12, integer as integer62, pgTable as pgTable126, smallint as smallint3, text as text127, timestamp as timestamp118, index as index112 } from "drizzle-orm/pg-core";
|
|
30413
30416
|
import { sql as sql39 } from "drizzle-orm";
|
|
30414
30417
|
var STATUS_IN = sql39.raw("('investigating', 'identified', 'monitoring', 'resolved')");
|
|
30415
30418
|
var platformIncidents = pgTable126(
|
|
@@ -30432,7 +30435,7 @@ var platformIncidents = pgTable126(
|
|
|
30432
30435
|
},
|
|
30433
30436
|
// Mirrors 0375 exactly: drizzle-kit push builds fresh DBs before the migration runs.
|
|
30434
30437
|
(t) => [
|
|
30435
|
-
|
|
30438
|
+
index112("platform_incidents_started_idx").on(t.startedAt.desc()),
|
|
30436
30439
|
check12("platform_incidents_severity_check", sql39`${t.severity} BETWEEN 1 AND 4`),
|
|
30437
30440
|
check12("platform_incidents_status_check", sql39`${t.status} IN ${STATUS_IN}`)
|
|
30438
30441
|
]
|
|
@@ -30448,7 +30451,7 @@ var platformIncidentUpdates = pgTable126(
|
|
|
30448
30451
|
createdAt: timestamp118("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
30449
30452
|
},
|
|
30450
30453
|
(t) => [
|
|
30451
|
-
|
|
30454
|
+
index112("platform_incident_updates_incident_idx").on(t.incidentId, t.createdAt),
|
|
30452
30455
|
check12("platform_incident_updates_status_check", sql39`${t.status} IN ${STATUS_IN}`)
|
|
30453
30456
|
]
|
|
30454
30457
|
);
|
|
@@ -30476,7 +30479,7 @@ var platformVendors = pgTable127("platform_vendors", {
|
|
|
30476
30479
|
});
|
|
30477
30480
|
|
|
30478
30481
|
// src/schema/platform_tasks.ts
|
|
30479
|
-
import { check as check13, date as date4, pgTable as pgTable128, text as text129, timestamp as timestamp120, index as
|
|
30482
|
+
import { check as check13, date as date4, pgTable as pgTable128, text as text129, timestamp as timestamp120, index as index113 } from "drizzle-orm/pg-core";
|
|
30480
30483
|
import { sql as sql40 } from "drizzle-orm";
|
|
30481
30484
|
var platformTasks = pgTable128(
|
|
30482
30485
|
"platform_tasks",
|
|
@@ -30502,8 +30505,8 @@ var platformTasks = pgTable128(
|
|
|
30502
30505
|
},
|
|
30503
30506
|
// Mirrors 0377 exactly: drizzle-kit push builds fresh DBs before the migration runs.
|
|
30504
30507
|
(t) => [
|
|
30505
|
-
|
|
30506
|
-
|
|
30508
|
+
index113("platform_tasks_open_idx").on(t.status, t.dueOn),
|
|
30509
|
+
index113("platform_tasks_entity_idx").on(t.entityType, t.entityId),
|
|
30507
30510
|
check13("platform_tasks_status_check", sql40`${t.status} IN ('open', 'in_progress', 'done')`),
|
|
30508
30511
|
check13("platform_tasks_priority_check", sql40`${t.priority} IN ('low', 'medium', 'high', 'urgent')`),
|
|
30509
30512
|
check13("platform_tasks_entity_type_check", sql40`${t.entityType} IN ('user', 'workspace', 'incident', 'deal')`),
|