okmodel 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/dist/dialects/pg/ext/btree-gin.d.ts +26 -0
- package/dist/dialects/pg/ext/btree-gin.js +20 -0
- package/dist/dialects/pg/ext/btree-gist.d.ts +26 -0
- package/dist/dialects/pg/ext/btree-gist.js +20 -0
- package/dist/dialects/pg/ext/call.d.ts +53 -0
- package/dist/dialects/pg/ext/citext.js +1 -1
- package/dist/dialects/pg/ext/feature.d.ts +26 -0
- package/dist/dialects/pg/ext/fuzzystrmatch.d.ts +34 -0
- package/dist/dialects/pg/ext/fuzzystrmatch.js +33 -0
- package/dist/dialects/pg/ext/hstore.d.ts +41 -0
- package/dist/dialects/pg/ext/hstore.js +29 -0
- package/dist/dialects/pg/ext/index.d.ts +56 -0
- package/dist/dialects/pg/ext/index.js +1 -1
- package/dist/dialects/pg/ext/ltree.d.ts +41 -0
- package/dist/dialects/pg/ext/ltree.js +29 -0
- package/dist/dialects/pg/ext/pg-trgm.js +4 -13
- package/dist/dialects/pg/ext/pgcrypto.d.ts +33 -0
- package/dist/dialects/pg/ext/pgcrypto.js +33 -0
- package/dist/dialects/pg/ext/unaccent.d.ts +26 -0
- package/dist/dialects/pg/ext/unaccent.js +21 -0
- package/dist/dialects/pg/ext/using.d.ts +23 -0
- package/dist/dialects/pg/ext/versions.d.ts +36 -0
- package/dist/dialects/pg/external.d.ts +19 -0
- package/dist/dialects/pg/fn/index.js +4 -4
- package/dist/dialects/pg/index.d.ts +1 -0
- package/dist/dialects/pg/index.js +16 -11
- package/dist/dialects/pg/view/index.js +5 -5
- package/dist/dialects/pg/view/scratch.d.ts +4 -1
- package/dist/runtime/artifact-file.d.ts +22 -0
- package/dist/runtime/client.d.ts +10 -0
- package/dist/runtime/drift-detail.d.ts +2 -1
- package/dist/runtime/drift.d.ts +3 -10
- package/dist/runtime/pg/bun.js +4 -4
- package/dist/runtime/pg/neon.js +4 -4
- package/dist/runtime/pg/pg.js +4 -4
- package/dist/runtime/pg/pglite.js +4 -4
- package/dist/runtime/pg/postgresjs.js +4 -4
- package/dist/runtime/server-check.d.ts +36 -6
- package/dist/runtime/traits/index.js +5 -5
- package/dist/runtime/validate/index.js +1 -1
- package/dist/shared/{4m6hskg8.js → 0j6qe91y.js} +4 -4
- package/dist/shared/{14x60fbf.js → 1mxm04fy.js} +5 -5
- package/dist/shared/{b6d6p0zc.js → 2szgv6yj.js} +5 -5
- package/dist/shared/{f4jy1j7x.js → 2zdxkt7b.js} +909 -100
- package/dist/shared/{mnvjvqyp.js → 3456242y.js} +17 -17
- package/dist/shared/3t6kw83m.js +1 -1
- package/dist/shared/{6m78c8ss.js → 5kyb3tqx.js} +1 -1
- package/dist/shared/61bmrmhr.js +35 -0
- package/dist/shared/{zbqbmmrp.js → 62b603gr.js} +8 -8
- package/dist/shared/{jgqj11w4.js → 6f0z3hzh.js} +4 -0
- package/dist/shared/{dpc2r7rb.js → 6nae0spm.js} +150 -89
- package/dist/shared/{0wrea3jq.js → 71n0jmhc.js} +1 -1
- package/dist/shared/7ba5h6pb.js +17 -0
- package/dist/shared/{k86n8vq3.js → 8jesqsrk.js} +1 -1
- package/dist/shared/{qd9hhd8f.js → 8n688yjg.js} +1 -1
- package/dist/shared/{zgex00fd.js → 8qzkd9f3.js} +5 -5
- package/dist/shared/{mkrn359n.js → 90sg0w5a.js} +159 -31
- package/dist/shared/{7ghwamrf.js → 99qp9vtg.js} +1 -1
- package/dist/shared/{bxas03mq.js → 9dtgn1z2.js} +1 -1
- package/dist/shared/{p5nh3r8q.js → aksb89mn.js} +2 -2
- package/dist/shared/{wcrheftc.js → bphrgwz9.js} +2 -2
- package/dist/shared/{wz2a78mp.js → c3mvnq7a.js} +1 -1
- package/dist/shared/{pan0370z.js → ccsmhv9r.js} +24 -6
- package/dist/shared/{n0jmpgj1.js → cexb7z6b.js} +1 -1
- package/dist/shared/{wvdjznah.js → cf8zdz5p.js} +5 -5
- package/dist/shared/{3449rcae.js → ckz05z15.js} +4 -4
- package/dist/shared/{35q0n9tz.js → dd5pmnky.js} +7 -7
- package/dist/shared/{e8zyaqvj.js → ds229x4r.js} +1 -1
- package/dist/{tooling/shared/yw30vnq2.js → shared/e275q7sd.js} +1 -1
- package/dist/shared/{mfedzr74.js → ebhz8vh6.js} +4 -4
- package/dist/shared/{z581d7ny.js → fdsz3w80.js} +2 -2
- package/dist/shared/{sjk86yrx.js → fk9vef30.js} +84 -73
- package/dist/shared/{needfe47.js → g89fmz5s.js} +1 -1
- package/dist/shared/{m4xff2a6.js → ghqzdp94.js} +2 -2
- package/dist/shared/h9811jjm.js +17 -0
- package/dist/shared/{kj9d8maq.js → jpybhf98.js} +1 -1
- package/dist/shared/kzgrnckd.js +29 -0
- package/dist/shared/{agsfb86s.js → mazpbcdj.js} +4 -4
- package/dist/shared/{195pzzzz.js → mgaq2sd3.js} +10 -7
- package/dist/shared/{5mtf6cj3.js → mvmm3xpb.js} +5 -2
- package/dist/shared/{p3xbdcvt.js → myk8fswx.js} +55 -6
- package/dist/shared/{njga14v4.js → n306gqkd.js} +8 -8
- package/dist/shared/n5whk3mt.js +665 -0
- package/dist/shared/{bah9nbg3.js → npdftanb.js} +12 -20
- package/dist/shared/{16kvjebh.js → pg4ezgyf.js} +7 -26
- package/dist/{tooling/shared/08kemxjd.js → shared/pgsak1yw.js} +1 -1
- package/dist/shared/{jp36k7dp.js → qvwwp1mp.js} +61 -40
- package/dist/shared/rbxt795q.js +1766 -0
- package/dist/shared/{g5yc06ka.js → s7he5e5d.js} +1 -1
- package/dist/shared/{hfqmpasr.js → ss2kv2rs.js} +5 -5
- package/dist/shared/stfa9xcw.js +450 -0
- package/dist/{tooling/shared/rs1jb051.js → shared/tr64w5p0.js} +1 -1
- package/dist/shared/{jebgrkeq.js → tw1nvvfj.js} +2 -2
- package/dist/shared/{v1wad97q.js → wvtjg5m3.js} +1 -1
- package/dist/shared/xqacq37x.js +61 -0
- package/dist/shared/{n05z9nwz.js → xtsydxjg.js} +1 -1
- package/dist/shared/{jx2m62cs.js → xv8qj97g.js} +5 -5
- package/dist/shared/{63f4ksbz.js → xwhdcrm4.js} +1 -1
- package/dist/shared/{hm5f8jby.js → yvabyg9k.js} +6 -6
- package/dist/shared/yybhre6n.js +136 -0
- package/dist/shared/zdqf8k5d.js +8 -0
- package/dist/tooling/cli.js +94 -22
- package/dist/tooling/driver-run.js +15 -332
- package/dist/tooling/github/comment.d.ts +50 -0
- package/dist/tooling/github/post-comment.d.ts +17 -0
- package/dist/tooling/migrate/commands.d.ts +2 -1
- package/dist/tooling/migrate/config.d.ts +13 -0
- package/dist/tooling/migrate/export.d.ts +165 -0
- package/dist/tooling/migrate/ext-surface.d.ts +80 -0
- package/dist/tooling/migrate/ext.d.ts +31 -4
- package/dist/tooling/migrate/import-drizzle.d.ts +40 -0
- package/dist/tooling/migrate/index.d.ts +3 -0
- package/dist/tooling/migrate/index.js +55 -10
- package/dist/tooling/migrate/lint-rules.d.ts +18 -1
- package/dist/tooling/migrate/lint.d.ts +14 -1
- package/dist/tooling/migrate/place.d.ts +18 -0
- package/dist/tooling/migrate/plan-json.d.ts +65 -0
- package/dist/tooling/migrate/project.d.ts +10 -1
- package/dist/tooling/migrate/pull-emit.d.ts +98 -0
- package/dist/tooling/migrate/pull-routines.d.ts +126 -0
- package/dist/tooling/migrate/pull-verify.d.ts +26 -0
- package/dist/tooling/migrate/pull.d.ts +62 -0
- package/dist/tooling/migrate/reprint.d.ts +32 -0
- package/dist/tooling/migrate/sandbox.d.ts +8 -2
- package/dist/tooling/migrate/schema-api.d.ts +43 -0
- package/dist/tooling/migrate/sql-lex.d.ts +18 -0
- package/dist/tooling/shared/{3m1hkg7z.js → 04svnxxj.js} +4 -4
- package/dist/tooling/shared/{ppnnnvj8.js → 0j0jtse1.js} +1 -1
- package/dist/tooling/shared/{z8d7ptht.js → 0r05zhyq.js} +5 -5
- package/dist/tooling/shared/{a6pp9d12.js → 1800eymw.js} +3 -3
- package/dist/tooling/shared/{cmptmb4f.js → 35zemrmf.js} +1 -1
- package/dist/tooling/shared/{w7qe8sj1.js → 3rmaz3pq.js} +1 -1
- package/dist/{shared/q0cqt2sp.js → tooling/shared/3yn79q5m.js} +1 -1
- package/dist/tooling/shared/{2revefqt.js → 57btdkgm.js} +2 -2
- package/dist/tooling/shared/{ma2340rx.js → 5bmksndh.js} +2 -2
- package/dist/tooling/shared/{9xzm7hjg.js → 5p8km5jb.js} +3 -3
- package/dist/tooling/shared/{xhrnjch9.js → 5x3pf400.js} +3 -3
- package/dist/tooling/shared/{wwnekq5n.js → 5zrzffnk.js} +1 -1
- package/dist/tooling/shared/{p7f08ktn.js → 62fxpc1p.js} +7 -7
- package/dist/tooling/shared/{7ae7rjmn.js → 68tf18v4.js} +2 -2
- package/dist/tooling/shared/{rf83gr2d.js → 6vk28rjp.js} +7 -3
- package/dist/tooling/shared/76pv6qff.js +9 -0
- package/dist/tooling/shared/{bz2dqhab.js → 7aews1zg.js} +3 -3
- package/dist/tooling/shared/{9kazs5p6.js → 7b3xp9gc.js} +3 -3
- package/dist/tooling/shared/{4d2w25vw.js → 7pxncnzs.js} +2 -2
- package/dist/tooling/shared/{zvnhh1n0.js → 829fjxyw.js} +2 -2
- package/dist/tooling/shared/{dzx85q70.js → 8m5znpdt.js} +1 -1
- package/dist/tooling/shared/{g9ad4n80.js → 8yr7ges1.js} +7 -7
- package/dist/tooling/shared/{tn8gay14.js → 9qr9rkbh.js} +6 -6
- package/dist/tooling/shared/{8sqrsw3s.js → 9sfbtwsk.js} +3 -3
- package/dist/{shared/bnby0esn.js → tooling/shared/9wsnsvbf.js} +1 -1
- package/dist/tooling/shared/{aftb2mwr.js → a2xe04bm.js} +1 -1
- package/dist/tooling/shared/{nf7jmhfa.js → a4pzghha.js} +2 -2
- package/dist/tooling/shared/{y5656f0e.js → am04v8na.js} +5 -5
- package/dist/tooling/shared/{417zdsk7.js → asgr07mp.js} +5 -5
- package/dist/tooling/shared/{pqy21k24.js → c0xevn1h.js} +4 -4
- package/dist/tooling/shared/dhatassp.js +134 -0
- package/dist/tooling/shared/{spk1jg3r.js → ezqn88nj.js} +8 -8
- package/dist/tooling/shared/{6nyfyw70.js → f77nnfqy.js} +2 -2
- package/dist/tooling/shared/{wt7j7nf6.js → fh07z1dt.js} +1 -1
- package/dist/tooling/shared/{3rrw5w8f.js → gqwevek4.js} +1 -1
- package/dist/tooling/shared/{f9mphxej.js → hfq3n3bd.js} +346 -19
- package/dist/tooling/shared/{vs0t6qt8.js → j664qjrt.js} +2 -2
- package/dist/tooling/shared/{733a1tq3.js → jpgmjsx3.js} +3 -3
- package/dist/tooling/shared/{mtrqn2hn.js → jr2nmr81.js} +22 -30
- package/dist/{shared/mtw6jz76.js → tooling/shared/jsjjz875.js} +1 -1
- package/dist/tooling/shared/{2wtvc7rw.js → kbqnrs1x.js} +2 -2
- package/dist/tooling/shared/{gfvtj6d0.js → kz715295.js} +7 -7
- package/dist/tooling/shared/{a7q7t4n3.js → m3xt8b1h.js} +2 -2
- package/dist/tooling/shared/{dw08f3m8.js → m4hhb8aa.js} +2 -2
- package/dist/tooling/shared/{y031jct9.js → mw5npye0.js} +2 -2
- package/dist/tooling/shared/{vraj6d74.js → nxq95eb6.js} +3 -3
- package/dist/tooling/shared/{fb9k2qwd.js → qartgazh.js} +11 -30
- package/dist/tooling/shared/{xjs6zqtc.js → rcywj2w8.js} +9 -9
- package/dist/tooling/shared/{dy672fz6.js → s6qha57m.js} +2 -2
- package/dist/tooling/shared/{vx86qjv8.js → shjs0379.js} +3 -3
- package/dist/tooling/shared/{345tbc2k.js → sjwkt1pg.js} +1 -1
- package/dist/tooling/shared/{rq5kk8j6.js → stebqyyd.js} +3 -3
- package/dist/tooling/shared/{yk9mp7vb.js → t4xveemq.js} +4 -4
- package/dist/tooling/shared/{djydjpqt.js → t6zjeake.js} +5 -5
- package/dist/tooling/shared/{zhwnfyb2.js → tcwpjvxe.js} +1 -1
- package/dist/tooling/shared/{72fyg4zv.js → tpssp7ac.js} +1 -1
- package/dist/tooling/shared/{jne7b93p.js → v6j1ep6w.js} +3 -3
- package/dist/tooling/shared/{ec71zqgt.js → vwr2y833.js} +2 -2
- package/dist/tooling/shared/{j9t5s12a.js → w17sj05d.js} +2 -2
- package/dist/tooling/shared/{3tq8pnb8.js → w5d89rb4.js} +1 -1
- package/dist/tooling/shared/{smn6kz1p.js → wbwq1jsa.js} +2 -2
- package/dist/tooling/shared/{pwsytxm5.js → wezxf3h8.js} +1 -1
- package/dist/tooling/shared/{5bvw2nev.js → yb4kd19s.js} +1 -1
- package/dist/tooling/shared/{gmcf9cxf.js → ybdew6j7.js} +2 -2
- package/dist/tooling/shared/{ep8zh3bk.js → yfedr1zb.js} +1 -1
- package/dist/tooling/shared/{ddjtfgnx.js → yhp829bx.js} +3 -3
- package/dist/tooling/shared/{yfr8hzhm.js → ytk1tjs0.js} +1 -1
- package/dist/tooling/shared/{03k6res6.js → zs9aymcp.js} +1 -1
- package/dist/tooling/shared/zx3v9phv.js +8 -0
- package/dist/tooling/testing/index.js +2 -2
- package/package.json +38 -9
- package/dist/shared/fjpnhqan.js +0 -71
- package/dist/shared/n41w4fbz.js +0 -113
- package/dist/tooling/shared/pw8fgahx.js +0 -69
- /package/dist/shared/{ae4j5f42.js → mfvx6kjx.js} +0 -0
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
materializedViewIndex
|
|
11
11
|
} from "./12z7aznj.js";
|
|
12
12
|
import {
|
|
13
|
-
|
|
14
|
-
} from "./
|
|
13
|
+
quoteIdent2
|
|
14
|
+
} from "./fk9vef30.js";
|
|
15
15
|
import {
|
|
16
|
-
|
|
17
|
-
} from "./
|
|
16
|
+
columnPrivilege
|
|
17
|
+
} from "./6nae0spm.js";
|
|
18
18
|
import {
|
|
19
19
|
policyObject
|
|
20
20
|
} from "./bdk4sty6.js";
|
|
@@ -265,7 +265,10 @@ async function introspectSchema(runner, concrete, logical = "public", options) {
|
|
|
265
265
|
...expression.length > 0 ? { expression } : {},
|
|
266
266
|
...refTable.length > 0 ? {
|
|
267
267
|
references: {
|
|
268
|
-
parent: {
|
|
268
|
+
parent: {
|
|
269
|
+
namespace: referencedNamespace(text(row, "ref_schema"), concrete, namespace),
|
|
270
|
+
name: refTable
|
|
271
|
+
},
|
|
269
272
|
columns: refColumns,
|
|
270
273
|
...onDelete !== undefined ? { onDelete } : {},
|
|
271
274
|
...onUpdate !== undefined ? { onUpdate } : {}
|
|
@@ -446,8 +449,38 @@ async function introspectSchema(runner, concrete, logical = "public", options) {
|
|
|
446
449
|
if (options?.managedRoles !== undefined) {
|
|
447
450
|
objects.push(...await readPrivileges(runner, concrete, logical, namespace, provenance, objects, options.managedRoles, options.reportingRole));
|
|
448
451
|
}
|
|
452
|
+
await includeOutsideReferences(runner, logical, provenance, objects);
|
|
449
453
|
return catalog(objects);
|
|
450
454
|
}
|
|
455
|
+
async function includeOutsideReferences(runner, logical, provenance, objects) {
|
|
456
|
+
const wanted = new Map;
|
|
457
|
+
for (const object of objects) {
|
|
458
|
+
if (object.kind !== "constraint" || object.definition.references === undefined)
|
|
459
|
+
continue;
|
|
460
|
+
const parent = object.definition.references.parent;
|
|
461
|
+
if (parent.namespace.form !== "static" || parent.namespace.name === logical)
|
|
462
|
+
continue;
|
|
463
|
+
wanted.set(`${parent.namespace.name}.${parent.name}`, {
|
|
464
|
+
schema: parent.namespace.name,
|
|
465
|
+
name: parent.name
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
for (const target of wanted.values()) {
|
|
469
|
+
const namespace = staticNamespace2(target.schema);
|
|
470
|
+
const parent = { namespace, name: target.name };
|
|
471
|
+
objects.push(table3({ namespace, name: target.name, provenance }));
|
|
472
|
+
const rows = await runner.query(OUTSIDE_COLUMNS, [target.schema, target.name]);
|
|
473
|
+
for (const row of rows) {
|
|
474
|
+
objects.push(column2({
|
|
475
|
+
parent,
|
|
476
|
+
name: text(row, "name"),
|
|
477
|
+
dataType: text(row, "type"),
|
|
478
|
+
nullable: !flag(row, "not_null"),
|
|
479
|
+
provenance
|
|
480
|
+
}));
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
451
484
|
var EMITTED = new Set(["SELECT", "INSERT", "UPDATE", "DELETE", "EXECUTE", "USAGE"]);
|
|
452
485
|
var ROLES = `select rolname, rolcanlogin, rolinherit from pg_roles where rolname !~ '^pg_'`;
|
|
453
486
|
var RELATION_GRANTS = `select c.relname as name,
|
|
@@ -704,7 +737,7 @@ function indexExpression(row, columns) {
|
|
|
704
737
|
const opclasses = list(text(row, "opc"));
|
|
705
738
|
const body = columns.map((name, index) => {
|
|
706
739
|
const opclass = opclasses[index];
|
|
707
|
-
return opclass === undefined ?
|
|
740
|
+
return opclass === undefined ? quoteIdent2(name) : `${quoteIdent2(name)} ${opclass}`;
|
|
708
741
|
}).join(", ");
|
|
709
742
|
return `using ${method} (${body.length > 0 ? body : stored})`;
|
|
710
743
|
}
|
|
@@ -761,6 +794,20 @@ var COLUMNS = `
|
|
|
761
794
|
and ${CHILD}
|
|
762
795
|
and ${member("c.oid", "pg_class")}
|
|
763
796
|
`;
|
|
797
|
+
function referencedNamespace(refSchema, concrete, logical) {
|
|
798
|
+
if (refSchema.length > 0 && refSchema !== concrete)
|
|
799
|
+
return staticNamespace2(refSchema);
|
|
800
|
+
return logical;
|
|
801
|
+
}
|
|
802
|
+
var OUTSIDE_COLUMNS = `
|
|
803
|
+
select a.attname as name, format_type(a.atttypid, a.atttypmod) as type, a.attnotnull as not_null
|
|
804
|
+
from pg_attribute a
|
|
805
|
+
join pg_class c on c.oid = a.attrelid
|
|
806
|
+
join pg_namespace n on n.oid = c.relnamespace
|
|
807
|
+
where n.nspname = $1 and c.relname = $2
|
|
808
|
+
and a.attnum > 0 and not a.attisdropped
|
|
809
|
+
order by a.attnum
|
|
810
|
+
`;
|
|
764
811
|
var CONSTRAINTS = `
|
|
765
812
|
select rel.relname as parent, con.conname as name, con.contype as contype,
|
|
766
813
|
con.condeferrable as deferrable, con.condeferred as deferred,
|
|
@@ -771,6 +818,7 @@ var CONSTRAINTS = `
|
|
|
771
818
|
join pg_attribute a on a.attrelid = con.conrelid and a.attnum = cols.attnum
|
|
772
819
|
) as columns,
|
|
773
820
|
ref.relname as ref_table,
|
|
821
|
+
refn.nspname as ref_schema,
|
|
774
822
|
(
|
|
775
823
|
select coalesce(string_agg(a.attname, ',' order by cols.ord), '')
|
|
776
824
|
from unnest(con.confkey) with ordinality as cols(attnum, ord)
|
|
@@ -780,6 +828,7 @@ var CONSTRAINTS = `
|
|
|
780
828
|
join pg_class rel on rel.oid = con.conrelid
|
|
781
829
|
join pg_namespace n on n.oid = rel.relnamespace
|
|
782
830
|
left join pg_class ref on ref.oid = con.confrelid
|
|
831
|
+
left join pg_namespace refn on refn.oid = ref.relnamespace
|
|
783
832
|
where n.nspname = $1
|
|
784
833
|
and con.contype in ('p', 'u', 'f', 'c')
|
|
785
834
|
and not exists (select 1 from pg_inherits i where i.inhrelid = rel.oid)
|
|
@@ -4,16 +4,16 @@ import {
|
|
|
4
4
|
applyProject2,
|
|
5
5
|
pushProject2,
|
|
6
6
|
backfillTiming2
|
|
7
|
-
} from "./
|
|
8
|
-
import"./
|
|
9
|
-
import"./
|
|
10
|
-
import"./
|
|
11
|
-
import"./
|
|
12
|
-
import"./
|
|
7
|
+
} from "./ccsmhv9r.js";
|
|
8
|
+
import"./3456242y.js";
|
|
9
|
+
import"./jpybhf98.js";
|
|
10
|
+
import"./myk8fswx.js";
|
|
11
|
+
import"./2zdxkt7b.js";
|
|
12
|
+
import"./6nae0spm.js";
|
|
13
13
|
import"./n442h54c.js";
|
|
14
|
-
import"./
|
|
14
|
+
import"./fk9vef30.js";
|
|
15
15
|
import"./12z7aznj.js";
|
|
16
|
-
import"./
|
|
16
|
+
import"./dd5pmnky.js";
|
|
17
17
|
export {
|
|
18
18
|
applyProject2 as applyProject,
|
|
19
19
|
applyTarget2 as applyTarget,
|