drizzle-kit 0.20.9 → 0.20.10-8c690cf

Sign up to get free protection for your applications and to get access to all the features.
package/bin.cjs CHANGED
@@ -4907,6 +4907,7 @@ var init_pgSchema = __esm({
4907
4907
  tableFrom: stringType(),
4908
4908
  columnsFrom: stringType().array(),
4909
4909
  tableTo: stringType(),
4910
+ schemaTo: stringType().optional(),
4910
4911
  columnsTo: stringType().array(),
4911
4912
  onUpdate: stringType().optional(),
4912
4913
  onDelete: stringType().optional()
@@ -5064,7 +5065,7 @@ var init_pgSchema = __esm({
5064
5065
  return result;
5065
5066
  },
5066
5067
  squashFK: (fk4) => {
5067
- return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${fk4.onUpdate ?? ""};${fk4.onDelete ?? ""}`;
5068
+ return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${fk4.onUpdate ?? ""};${fk4.onDelete ?? ""};${fk4.schemaTo ?? ""}`;
5068
5069
  },
5069
5070
  squashPK: (pk) => {
5070
5071
  return `${pk.columns.join(",")};${pk.name}`;
@@ -5092,12 +5093,14 @@ var init_pgSchema = __esm({
5092
5093
  tableTo,
5093
5094
  columnsToStr,
5094
5095
  onUpdate,
5095
- onDelete
5096
+ onDelete,
5097
+ schemaTo
5096
5098
  ] = input.split(";");
5097
5099
  const result = fk2.parse({
5098
5100
  name,
5099
5101
  tableFrom,
5100
5102
  columnsFrom: columnsFromStr.split(","),
5103
+ schemaTo,
5101
5104
  tableTo,
5102
5105
  columnsTo: columnsToStr.split(","),
5103
5106
  onUpdate,
@@ -12313,12 +12316,14 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
12313
12316
  const onUpdate = fk4.onUpdate;
12314
12317
  const reference = fk4.reference();
12315
12318
  const tableTo = (0, import_drizzle_orm5.getTableName)(reference.foreignTable);
12319
+ const schemaTo = (0, import_pg_core3.getTableConfig)(reference.foreignTable).schema;
12316
12320
  const columnsFrom = reference.columns.map((it) => it.name);
12317
12321
  const columnsTo = reference.foreignColumns.map((it) => it.name);
12318
12322
  return {
12319
12323
  name,
12320
12324
  tableFrom,
12321
12325
  tableTo,
12326
+ schemaTo: schemaTo ?? "public",
12322
12327
  columnsFrom,
12323
12328
  columnsTo,
12324
12329
  onDelete,
@@ -12495,24 +12500,29 @@ ${withStyle.errorWarning(
12495
12500
  }
12496
12501
  const tableForeignKeys = await db.query(
12497
12502
  `SELECT
12498
- tc.table_schema,
12499
- tc.constraint_name,
12500
- tc.table_name,
12501
- kcu.column_name,
12502
- ccu.table_schema AS foreign_table_schema,
12503
- ccu.table_name AS foreign_table_name,
12504
- ccu.column_name AS foreign_column_name,
12505
- rc.delete_rule, rc.update_rule
12506
- FROM
12507
- information_schema.table_constraints AS tc
12508
- JOIN information_schema.key_column_usage AS kcu
12509
- ON tc.constraint_name = kcu.constraint_name
12510
- AND tc.table_schema = kcu.table_schema
12511
- JOIN information_schema.constraint_column_usage AS ccu
12512
- ON ccu.constraint_name = tc.constraint_name
12513
- AND ccu.table_schema = tc.table_schema
12514
- JOIN information_schema.referential_constraints AS rc
12515
- ON ccu.constraint_name = rc.constraint_name
12503
+ tc.table_schema,
12504
+ tc.constraint_name,
12505
+ tc.table_name,
12506
+ kcu.column_name,
12507
+ (
12508
+ SELECT ccu.table_schema
12509
+ FROM information_schema.constraint_column_usage ccu
12510
+ WHERE ccu.constraint_name = tc.constraint_name
12511
+ LIMIT 1
12512
+ ) AS foreign_table_schema,
12513
+ ccu.table_name AS foreign_table_name,
12514
+ ccu.column_name AS foreign_column_name,
12515
+ rc.delete_rule,
12516
+ rc.update_rule
12517
+ FROM
12518
+ information_schema.table_constraints AS tc
12519
+ JOIN information_schema.key_column_usage AS kcu
12520
+ ON tc.constraint_name = kcu.constraint_name
12521
+ AND tc.table_schema = kcu.table_schema
12522
+ JOIN information_schema.constraint_column_usage AS ccu
12523
+ ON ccu.constraint_name = tc.constraint_name
12524
+ JOIN information_schema.referential_constraints AS rc
12525
+ ON ccu.constraint_name = rc.constraint_name
12516
12526
  WHERE tc.constraint_type = 'FOREIGN KEY' AND tc.table_name='${tableName}' and tc.table_schema='${tableSchema}';`
12517
12527
  );
12518
12528
  foreignKeysCount += tableForeignKeys.length;
@@ -12523,6 +12533,7 @@ ${withStyle.errorWarning(
12523
12533
  const columnFrom = fk4.column_name;
12524
12534
  const tableTo = fk4.foreign_table_name;
12525
12535
  const columnTo = fk4.foreign_column_name;
12536
+ const schemaTo = fk4.foreign_table_schema;
12526
12537
  const foreignKeyName = fk4.constraint_name;
12527
12538
  const onUpdate = fk4.update_rule.toLowerCase();
12528
12539
  const onDelete = fk4.delete_rule.toLowerCase();
@@ -12534,6 +12545,7 @@ ${withStyle.errorWarning(
12534
12545
  name: foreignKeyName,
12535
12546
  tableFrom: tableName,
12536
12547
  tableTo,
12548
+ schemaTo,
12537
12549
  columnsFrom: [columnFrom],
12538
12550
  columnsTo: [columnTo],
12539
12551
  onDelete,
@@ -16166,14 +16178,15 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
16166
16178
  columnsFrom,
16167
16179
  columnsTo,
16168
16180
  onDelete,
16169
- onUpdate
16181
+ onUpdate,
16182
+ schemaTo
16170
16183
  } = PgSquasher.unsquashFK(statement.data);
16171
16184
  const onDeleteStatement = onDelete ? ` ON DELETE ${onDelete}` : "";
16172
16185
  const onUpdateStatement = onUpdate ? ` ON UPDATE ${onUpdate}` : "";
16173
16186
  const fromColumnsString = columnsFrom.map((it) => `"${it}"`).join(",");
16174
16187
  const toColumnsString = columnsTo.map((it) => `"${it}"`).join(",");
16175
16188
  const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${tableFrom}"` : `"${tableFrom}"`;
16176
- const tableToNameWithSchema = statement.schema ? `"${statement.schema}"."${tableTo}"` : `"${tableTo}"`;
16189
+ const tableToNameWithSchema = schemaTo ? `"${schemaTo}"."${tableTo}"` : `"${tableTo}"`;
16177
16190
  const alterStatement = `ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${name}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement}`;
16178
16191
  let sql2 = "DO $$ BEGIN\n";
16179
16192
  sql2 += " " + alterStatement + ";\n";
@@ -16232,8 +16245,9 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
16232
16245
  const onUpdateStatement = newFk.onUpdate ? ` ON UPDATE ${newFk.onUpdate}` : "";
16233
16246
  const fromColumnsString = newFk.columnsFrom.map((it) => `"${it}"`).join(",");
16234
16247
  const toColumnsString = newFk.columnsTo.map((it) => `"${it}"`).join(",");
16235
- const tableFromNameWithSchema = statement.schema ? `"${statement.schema}"."${newFk.tableFrom}"` : `"${newFk.tableFrom}"`;
16236
- const alterStatement = `ALTER TABLE ${tableFromNameWithSchema} ADD CONSTRAINT "${newFk.name}" FOREIGN KEY (${fromColumnsString}) REFERENCES "${newFk.tableTo}"(${toColumnsString})${onDeleteStatement}${onUpdateStatement}`;
16248
+ const tableFromNameWithSchema = oldFk.schemaTo ? `"${oldFk.schemaTo}"."${oldFk.tableFrom}"` : `"${oldFk.tableFrom}"`;
16249
+ const tableToNameWithSchema = newFk.schemaTo ? `"${newFk.schemaTo}"."${newFk.tableFrom}"` : `"${newFk.tableFrom}"`;
16250
+ const alterStatement = `ALTER TABLE ${tableFromNameWithSchema} ADD CONSTRAINT "${newFk.name}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement}`;
16237
16251
  sql2 += "DO $$ BEGIN\n";
16238
16252
  sql2 += " " + alterStatement + ";\n";
16239
16253
  sql2 += "EXCEPTION\n";
@@ -19034,7 +19048,7 @@ var init_introspect_pg = __esm({
19034
19048
  const schemaStatements = Object.entries(schemas).map((it) => {
19035
19049
  return `export const ${it[1]} = pgSchema("${it[0]}");
19036
19050
  `;
19037
- }).join();
19051
+ }).join("");
19038
19052
  const tableStatements = Object.values(schema4.tables).map((table4) => {
19039
19053
  const tableSchema = schemas[table4.schema];
19040
19054
  const func = tableSchema ? `${tableSchema}.table` : "pgTable";
@@ -62069,7 +62083,7 @@ init_source();
62069
62083
  // package.json
62070
62084
  var package_default = {
62071
62085
  name: "drizzle-kit",
62072
- version: "0.20.9",
62086
+ version: "0.20.10",
62073
62087
  repository: "https://github.com/drizzle-team/drizzle-kit-mirror",
62074
62088
  author: "Drizzle Team",
62075
62089
  license: "MIT",
@@ -63494,15 +63508,15 @@ var introspectPgCommand = new import_commander.Command("introspect:pg").option("
63494
63508
  dryMySql,
63495
63509
  schema4
63496
63510
  );
63497
- writeResult(
63498
- schema4,
63511
+ writeResult({
63512
+ cur: schema4,
63499
63513
  sqlStatements,
63500
63514
  journal,
63501
63515
  _meta,
63502
- validatedConfig.out,
63503
- validatedConfig.breakpoints,
63504
- "introspect"
63505
- );
63516
+ outFolder: validatedConfig.out,
63517
+ breakpoints: validatedConfig.breakpoints,
63518
+ type: "introspect"
63519
+ });
63506
63520
  } else {
63507
63521
  (0, import_hanji11.render)(
63508
63522
  `[${source_default.blue(
@@ -63547,15 +63561,15 @@ var introspectMySqlCommand = new import_commander.Command("introspect:mysql").op
63547
63561
  dryMySql,
63548
63562
  schema4
63549
63563
  );
63550
- writeResult(
63551
- schema4,
63564
+ writeResult({
63565
+ cur: schema4,
63552
63566
  sqlStatements,
63553
63567
  journal,
63554
63568
  _meta,
63555
- out,
63556
- res.breakpoints ?? false,
63557
- "introspect"
63558
- );
63569
+ outFolder: out,
63570
+ breakpoints: res.breakpoints ?? false,
63571
+ type: "introspect"
63572
+ });
63559
63573
  } else {
63560
63574
  (0, import_hanji11.render)(
63561
63575
  `[${source_default.blue(
@@ -63600,15 +63614,15 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
63600
63614
  drySQLite,
63601
63615
  schema4
63602
63616
  );
63603
- writeResult(
63604
- schema4,
63617
+ writeResult({
63618
+ cur: schema4,
63605
63619
  sqlStatements,
63606
63620
  journal,
63607
63621
  _meta,
63608
- out,
63609
- res.breakpoints ?? false,
63610
- "introspect"
63611
- );
63622
+ outFolder: out,
63623
+ breakpoints: res.breakpoints ?? false,
63624
+ type: "introspect"
63625
+ });
63612
63626
  } else {
63613
63627
  (0, import_hanji11.render)(
63614
63628
  `[${source_default.blue(
@@ -63642,7 +63656,9 @@ var dropCommand = new import_commander.Command("drop").option("--out <out>", `Ou
63642
63656
  if (typeof options.driver !== "undefined") {
63643
63657
  bundle = options.driver === "expo";
63644
63658
  } else {
63645
- const drizzleConfig = await drizzleConfigFromFile(options.config);
63659
+ const drizzleConfig = await drizzleConfigFromFile(
63660
+ options.config
63661
+ );
63646
63662
  bundle = drizzleConfig.driver === "expo";
63647
63663
  }
63648
63664
  assertV1OutFolder(out, "{dialect}");
@@ -29,6 +29,7 @@ export declare const pgPushIntrospect: (connection: {
29
29
  foreignKeys: Record<string, {
30
30
  onUpdate?: string | undefined;
31
31
  onDelete?: string | undefined;
32
+ schemaTo?: string | undefined;
32
33
  name: string;
33
34
  tableFrom: string;
34
35
  columnsFrom: string[];
@@ -84,6 +85,7 @@ export declare const pgIntrospect: (config: PgConfigIntrospect, filters: string[
84
85
  foreignKeys: Record<string, {
85
86
  onUpdate?: string | undefined;
86
87
  onDelete?: string | undefined;
88
+ schemaTo?: string | undefined;
87
89
  name: string;
88
90
  tableFrom: string;
89
91
  columnsFrom: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.20.9",
3
+ "version": "0.20.10-8c690cf",
4
4
  "repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
5
5
  "author": "Drizzle Team",
6
6
  "license": "MIT",
@@ -400,12 +400,14 @@ declare const commonSchema: import("zod").ZodUnion<[import("zod").ZodObject<impo
400
400
  tableFrom: import("zod").ZodString;
401
401
  columnsFrom: import("zod").ZodArray<import("zod").ZodString, "many">;
402
402
  tableTo: import("zod").ZodString;
403
+ schemaTo: import("zod").ZodOptional<import("zod").ZodString>;
403
404
  columnsTo: import("zod").ZodArray<import("zod").ZodString, "many">;
404
405
  onUpdate: import("zod").ZodOptional<import("zod").ZodString>;
405
406
  onDelete: import("zod").ZodOptional<import("zod").ZodString>;
406
407
  }, "strict", import("zod").ZodTypeAny, {
407
408
  onUpdate?: string | undefined;
408
409
  onDelete?: string | undefined;
410
+ schemaTo?: string | undefined;
409
411
  name: string;
410
412
  tableFrom: string;
411
413
  columnsFrom: string[];
@@ -414,6 +416,7 @@ declare const commonSchema: import("zod").ZodUnion<[import("zod").ZodObject<impo
414
416
  }, {
415
417
  onUpdate?: string | undefined;
416
418
  onDelete?: string | undefined;
419
+ schemaTo?: string | undefined;
417
420
  name: string;
418
421
  tableFrom: string;
419
422
  columnsFrom: string[];
@@ -463,6 +466,7 @@ declare const commonSchema: import("zod").ZodUnion<[import("zod").ZodObject<impo
463
466
  foreignKeys: Record<string, {
464
467
  onUpdate?: string | undefined;
465
468
  onDelete?: string | undefined;
469
+ schemaTo?: string | undefined;
466
470
  name: string;
467
471
  tableFrom: string;
468
472
  columnsFrom: string[];
@@ -504,6 +508,7 @@ declare const commonSchema: import("zod").ZodUnion<[import("zod").ZodObject<impo
504
508
  foreignKeys: Record<string, {
505
509
  onUpdate?: string | undefined;
506
510
  onDelete?: string | undefined;
511
+ schemaTo?: string | undefined;
507
512
  name: string;
508
513
  tableFrom: string;
509
514
  columnsFrom: string[];
@@ -622,6 +627,7 @@ declare const commonSchema: import("zod").ZodUnion<[import("zod").ZodObject<impo
622
627
  foreignKeys: Record<string, {
623
628
  onUpdate?: string | undefined;
624
629
  onDelete?: string | undefined;
630
+ schemaTo?: string | undefined;
625
631
  name: string;
626
632
  tableFrom: string;
627
633
  columnsFrom: string[];
@@ -688,6 +694,7 @@ declare const commonSchema: import("zod").ZodUnion<[import("zod").ZodObject<impo
688
694
  foreignKeys: Record<string, {
689
695
  onUpdate?: string | undefined;
690
696
  onDelete?: string | undefined;
697
+ schemaTo?: string | undefined;
691
698
  name: string;
692
699
  tableFrom: string;
693
700
  columnsFrom: string[];
@@ -367,12 +367,14 @@ declare const fk: import("zod").ZodObject<{
367
367
  tableFrom: import("zod").ZodString;
368
368
  columnsFrom: import("zod").ZodArray<import("zod").ZodString, "many">;
369
369
  tableTo: import("zod").ZodString;
370
+ schemaTo: import("zod").ZodOptional<import("zod").ZodString>;
370
371
  columnsTo: import("zod").ZodArray<import("zod").ZodString, "many">;
371
372
  onUpdate: import("zod").ZodOptional<import("zod").ZodString>;
372
373
  onDelete: import("zod").ZodOptional<import("zod").ZodString>;
373
374
  }, "strict", import("zod").ZodTypeAny, {
374
375
  onUpdate?: string | undefined;
375
376
  onDelete?: string | undefined;
377
+ schemaTo?: string | undefined;
376
378
  name: string;
377
379
  tableFrom: string;
378
380
  columnsFrom: string[];
@@ -381,6 +383,7 @@ declare const fk: import("zod").ZodObject<{
381
383
  }, {
382
384
  onUpdate?: string | undefined;
383
385
  onDelete?: string | undefined;
386
+ schemaTo?: string | undefined;
384
387
  name: string;
385
388
  tableFrom: string;
386
389
  columnsFrom: string[];
@@ -463,12 +466,14 @@ declare const tableV3: import("zod").ZodObject<{
463
466
  tableFrom: import("zod").ZodString;
464
467
  columnsFrom: import("zod").ZodArray<import("zod").ZodString, "many">;
465
468
  tableTo: import("zod").ZodString;
469
+ schemaTo: import("zod").ZodOptional<import("zod").ZodString>;
466
470
  columnsTo: import("zod").ZodArray<import("zod").ZodString, "many">;
467
471
  onUpdate: import("zod").ZodOptional<import("zod").ZodString>;
468
472
  onDelete: import("zod").ZodOptional<import("zod").ZodString>;
469
473
  }, "strict", import("zod").ZodTypeAny, {
470
474
  onUpdate?: string | undefined;
471
475
  onDelete?: string | undefined;
476
+ schemaTo?: string | undefined;
472
477
  name: string;
473
478
  tableFrom: string;
474
479
  columnsFrom: string[];
@@ -477,6 +482,7 @@ declare const tableV3: import("zod").ZodObject<{
477
482
  }, {
478
483
  onUpdate?: string | undefined;
479
484
  onDelete?: string | undefined;
485
+ schemaTo?: string | undefined;
480
486
  name: string;
481
487
  tableFrom: string;
482
488
  columnsFrom: string[];
@@ -503,6 +509,7 @@ declare const tableV3: import("zod").ZodObject<{
503
509
  foreignKeys: Record<string, {
504
510
  onUpdate?: string | undefined;
505
511
  onDelete?: string | undefined;
512
+ schemaTo?: string | undefined;
506
513
  name: string;
507
514
  tableFrom: string;
508
515
  columnsFrom: string[];
@@ -529,6 +536,7 @@ declare const tableV3: import("zod").ZodObject<{
529
536
  foreignKeys: Record<string, {
530
537
  onUpdate?: string | undefined;
531
538
  onDelete?: string | undefined;
539
+ schemaTo?: string | undefined;
532
540
  name: string;
533
541
  tableFrom: string;
534
542
  columnsFrom: string[];
@@ -608,12 +616,14 @@ declare const tableV4: import("zod").ZodObject<{
608
616
  tableFrom: import("zod").ZodString;
609
617
  columnsFrom: import("zod").ZodArray<import("zod").ZodString, "many">;
610
618
  tableTo: import("zod").ZodString;
619
+ schemaTo: import("zod").ZodOptional<import("zod").ZodString>;
611
620
  columnsTo: import("zod").ZodArray<import("zod").ZodString, "many">;
612
621
  onUpdate: import("zod").ZodOptional<import("zod").ZodString>;
613
622
  onDelete: import("zod").ZodOptional<import("zod").ZodString>;
614
623
  }, "strict", import("zod").ZodTypeAny, {
615
624
  onUpdate?: string | undefined;
616
625
  onDelete?: string | undefined;
626
+ schemaTo?: string | undefined;
617
627
  name: string;
618
628
  tableFrom: string;
619
629
  columnsFrom: string[];
@@ -622,6 +632,7 @@ declare const tableV4: import("zod").ZodObject<{
622
632
  }, {
623
633
  onUpdate?: string | undefined;
624
634
  onDelete?: string | undefined;
635
+ schemaTo?: string | undefined;
625
636
  name: string;
626
637
  tableFrom: string;
627
638
  columnsFrom: string[];
@@ -648,6 +659,7 @@ declare const tableV4: import("zod").ZodObject<{
648
659
  foreignKeys: Record<string, {
649
660
  onUpdate?: string | undefined;
650
661
  onDelete?: string | undefined;
662
+ schemaTo?: string | undefined;
651
663
  name: string;
652
664
  tableFrom: string;
653
665
  columnsFrom: string[];
@@ -675,6 +687,7 @@ declare const tableV4: import("zod").ZodObject<{
675
687
  foreignKeys: Record<string, {
676
688
  onUpdate?: string | undefined;
677
689
  onDelete?: string | undefined;
690
+ schemaTo?: string | undefined;
678
691
  name: string;
679
692
  tableFrom: string;
680
693
  columnsFrom: string[];
@@ -732,12 +745,14 @@ declare const table: import("zod").ZodObject<{
732
745
  tableFrom: import("zod").ZodString;
733
746
  columnsFrom: import("zod").ZodArray<import("zod").ZodString, "many">;
734
747
  tableTo: import("zod").ZodString;
748
+ schemaTo: import("zod").ZodOptional<import("zod").ZodString>;
735
749
  columnsTo: import("zod").ZodArray<import("zod").ZodString, "many">;
736
750
  onUpdate: import("zod").ZodOptional<import("zod").ZodString>;
737
751
  onDelete: import("zod").ZodOptional<import("zod").ZodString>;
738
752
  }, "strict", import("zod").ZodTypeAny, {
739
753
  onUpdate?: string | undefined;
740
754
  onDelete?: string | undefined;
755
+ schemaTo?: string | undefined;
741
756
  name: string;
742
757
  tableFrom: string;
743
758
  columnsFrom: string[];
@@ -746,6 +761,7 @@ declare const table: import("zod").ZodObject<{
746
761
  }, {
747
762
  onUpdate?: string | undefined;
748
763
  onDelete?: string | undefined;
764
+ schemaTo?: string | undefined;
749
765
  name: string;
750
766
  tableFrom: string;
751
767
  columnsFrom: string[];
@@ -795,6 +811,7 @@ declare const table: import("zod").ZodObject<{
795
811
  foreignKeys: Record<string, {
796
812
  onUpdate?: string | undefined;
797
813
  onDelete?: string | undefined;
814
+ schemaTo?: string | undefined;
798
815
  name: string;
799
816
  tableFrom: string;
800
817
  columnsFrom: string[];
@@ -836,6 +853,7 @@ declare const table: import("zod").ZodObject<{
836
853
  foreignKeys: Record<string, {
837
854
  onUpdate?: string | undefined;
838
855
  onDelete?: string | undefined;
856
+ schemaTo?: string | undefined;
839
857
  name: string;
840
858
  tableFrom: string;
841
859
  columnsFrom: string[];
@@ -899,12 +917,14 @@ export declare const pgSchemaInternalV3: import("zod").ZodObject<{
899
917
  tableFrom: import("zod").ZodString;
900
918
  columnsFrom: import("zod").ZodArray<import("zod").ZodString, "many">;
901
919
  tableTo: import("zod").ZodString;
920
+ schemaTo: import("zod").ZodOptional<import("zod").ZodString>;
902
921
  columnsTo: import("zod").ZodArray<import("zod").ZodString, "many">;
903
922
  onUpdate: import("zod").ZodOptional<import("zod").ZodString>;
904
923
  onDelete: import("zod").ZodOptional<import("zod").ZodString>;
905
924
  }, "strict", import("zod").ZodTypeAny, {
906
925
  onUpdate?: string | undefined;
907
926
  onDelete?: string | undefined;
927
+ schemaTo?: string | undefined;
908
928
  name: string;
909
929
  tableFrom: string;
910
930
  columnsFrom: string[];
@@ -913,6 +933,7 @@ export declare const pgSchemaInternalV3: import("zod").ZodObject<{
913
933
  }, {
914
934
  onUpdate?: string | undefined;
915
935
  onDelete?: string | undefined;
936
+ schemaTo?: string | undefined;
916
937
  name: string;
917
938
  tableFrom: string;
918
939
  columnsFrom: string[];
@@ -939,6 +960,7 @@ export declare const pgSchemaInternalV3: import("zod").ZodObject<{
939
960
  foreignKeys: Record<string, {
940
961
  onUpdate?: string | undefined;
941
962
  onDelete?: string | undefined;
963
+ schemaTo?: string | undefined;
942
964
  name: string;
943
965
  tableFrom: string;
944
966
  columnsFrom: string[];
@@ -965,6 +987,7 @@ export declare const pgSchemaInternalV3: import("zod").ZodObject<{
965
987
  foreignKeys: Record<string, {
966
988
  onUpdate?: string | undefined;
967
989
  onDelete?: string | undefined;
990
+ schemaTo?: string | undefined;
968
991
  name: string;
969
992
  tableFrom: string;
970
993
  columnsFrom: string[];
@@ -1005,6 +1028,7 @@ export declare const pgSchemaInternalV3: import("zod").ZodObject<{
1005
1028
  foreignKeys: Record<string, {
1006
1029
  onUpdate?: string | undefined;
1007
1030
  onDelete?: string | undefined;
1031
+ schemaTo?: string | undefined;
1008
1032
  name: string;
1009
1033
  tableFrom: string;
1010
1034
  columnsFrom: string[];
@@ -1039,6 +1063,7 @@ export declare const pgSchemaInternalV3: import("zod").ZodObject<{
1039
1063
  foreignKeys: Record<string, {
1040
1064
  onUpdate?: string | undefined;
1041
1065
  onDelete?: string | undefined;
1066
+ schemaTo?: string | undefined;
1042
1067
  name: string;
1043
1068
  tableFrom: string;
1044
1069
  columnsFrom: string[];
@@ -1103,12 +1128,14 @@ export declare const pgSchemaInternalV4: import("zod").ZodObject<{
1103
1128
  tableFrom: import("zod").ZodString;
1104
1129
  columnsFrom: import("zod").ZodArray<import("zod").ZodString, "many">;
1105
1130
  tableTo: import("zod").ZodString;
1131
+ schemaTo: import("zod").ZodOptional<import("zod").ZodString>;
1106
1132
  columnsTo: import("zod").ZodArray<import("zod").ZodString, "many">;
1107
1133
  onUpdate: import("zod").ZodOptional<import("zod").ZodString>;
1108
1134
  onDelete: import("zod").ZodOptional<import("zod").ZodString>;
1109
1135
  }, "strict", import("zod").ZodTypeAny, {
1110
1136
  onUpdate?: string | undefined;
1111
1137
  onDelete?: string | undefined;
1138
+ schemaTo?: string | undefined;
1112
1139
  name: string;
1113
1140
  tableFrom: string;
1114
1141
  columnsFrom: string[];
@@ -1117,6 +1144,7 @@ export declare const pgSchemaInternalV4: import("zod").ZodObject<{
1117
1144
  }, {
1118
1145
  onUpdate?: string | undefined;
1119
1146
  onDelete?: string | undefined;
1147
+ schemaTo?: string | undefined;
1120
1148
  name: string;
1121
1149
  tableFrom: string;
1122
1150
  columnsFrom: string[];
@@ -1143,6 +1171,7 @@ export declare const pgSchemaInternalV4: import("zod").ZodObject<{
1143
1171
  foreignKeys: Record<string, {
1144
1172
  onUpdate?: string | undefined;
1145
1173
  onDelete?: string | undefined;
1174
+ schemaTo?: string | undefined;
1146
1175
  name: string;
1147
1176
  tableFrom: string;
1148
1177
  columnsFrom: string[];
@@ -1170,6 +1199,7 @@ export declare const pgSchemaInternalV4: import("zod").ZodObject<{
1170
1199
  foreignKeys: Record<string, {
1171
1200
  onUpdate?: string | undefined;
1172
1201
  onDelete?: string | undefined;
1202
+ schemaTo?: string | undefined;
1173
1203
  name: string;
1174
1204
  tableFrom: string;
1175
1205
  columnsFrom: string[];
@@ -1212,6 +1242,7 @@ export declare const pgSchemaInternalV4: import("zod").ZodObject<{
1212
1242
  foreignKeys: Record<string, {
1213
1243
  onUpdate?: string | undefined;
1214
1244
  onDelete?: string | undefined;
1245
+ schemaTo?: string | undefined;
1215
1246
  name: string;
1216
1247
  tableFrom: string;
1217
1248
  columnsFrom: string[];
@@ -1248,6 +1279,7 @@ export declare const pgSchemaInternalV4: import("zod").ZodObject<{
1248
1279
  foreignKeys: Record<string, {
1249
1280
  onUpdate?: string | undefined;
1250
1281
  onDelete?: string | undefined;
1282
+ schemaTo?: string | undefined;
1251
1283
  name: string;
1252
1284
  tableFrom: string;
1253
1285
  columnsFrom: string[];
@@ -1314,12 +1346,14 @@ export declare const pgSchemaExternal: import("zod").ZodObject<{
1314
1346
  tableFrom: import("zod").ZodString;
1315
1347
  columnsFrom: import("zod").ZodArray<import("zod").ZodString, "many">;
1316
1348
  tableTo: import("zod").ZodString;
1349
+ schemaTo: import("zod").ZodOptional<import("zod").ZodString>;
1317
1350
  columnsTo: import("zod").ZodArray<import("zod").ZodString, "many">;
1318
1351
  onUpdate: import("zod").ZodOptional<import("zod").ZodString>;
1319
1352
  onDelete: import("zod").ZodOptional<import("zod").ZodString>;
1320
1353
  }, "strict", import("zod").ZodTypeAny, {
1321
1354
  onUpdate?: string | undefined;
1322
1355
  onDelete?: string | undefined;
1356
+ schemaTo?: string | undefined;
1323
1357
  name: string;
1324
1358
  tableFrom: string;
1325
1359
  columnsFrom: string[];
@@ -1328,6 +1362,7 @@ export declare const pgSchemaExternal: import("zod").ZodObject<{
1328
1362
  }, {
1329
1363
  onUpdate?: string | undefined;
1330
1364
  onDelete?: string | undefined;
1365
+ schemaTo?: string | undefined;
1331
1366
  name: string;
1332
1367
  tableFrom: string;
1333
1368
  columnsFrom: string[];
@@ -1377,6 +1412,7 @@ export declare const pgSchemaExternal: import("zod").ZodObject<{
1377
1412
  foreignKeys: Record<string, {
1378
1413
  onUpdate?: string | undefined;
1379
1414
  onDelete?: string | undefined;
1415
+ schemaTo?: string | undefined;
1380
1416
  name: string;
1381
1417
  tableFrom: string;
1382
1418
  columnsFrom: string[];
@@ -1418,6 +1454,7 @@ export declare const pgSchemaExternal: import("zod").ZodObject<{
1418
1454
  foreignKeys: Record<string, {
1419
1455
  onUpdate?: string | undefined;
1420
1456
  onDelete?: string | undefined;
1457
+ schemaTo?: string | undefined;
1421
1458
  name: string;
1422
1459
  tableFrom: string;
1423
1460
  columnsFrom: string[];
@@ -1483,6 +1520,7 @@ export declare const pgSchemaExternal: import("zod").ZodObject<{
1483
1520
  foreignKeys: Record<string, {
1484
1521
  onUpdate?: string | undefined;
1485
1522
  onDelete?: string | undefined;
1523
+ schemaTo?: string | undefined;
1486
1524
  name: string;
1487
1525
  tableFrom: string;
1488
1526
  columnsFrom: string[];
@@ -1540,6 +1578,7 @@ export declare const pgSchemaExternal: import("zod").ZodObject<{
1540
1578
  foreignKeys: Record<string, {
1541
1579
  onUpdate?: string | undefined;
1542
1580
  onDelete?: string | undefined;
1581
+ schemaTo?: string | undefined;
1543
1582
  name: string;
1544
1583
  tableFrom: string;
1545
1584
  columnsFrom: string[];
@@ -1662,12 +1701,14 @@ export declare const pgSchemaInternal: import("zod").ZodObject<{
1662
1701
  tableFrom: import("zod").ZodString;
1663
1702
  columnsFrom: import("zod").ZodArray<import("zod").ZodString, "many">;
1664
1703
  tableTo: import("zod").ZodString;
1704
+ schemaTo: import("zod").ZodOptional<import("zod").ZodString>;
1665
1705
  columnsTo: import("zod").ZodArray<import("zod").ZodString, "many">;
1666
1706
  onUpdate: import("zod").ZodOptional<import("zod").ZodString>;
1667
1707
  onDelete: import("zod").ZodOptional<import("zod").ZodString>;
1668
1708
  }, "strict", import("zod").ZodTypeAny, {
1669
1709
  onUpdate?: string | undefined;
1670
1710
  onDelete?: string | undefined;
1711
+ schemaTo?: string | undefined;
1671
1712
  name: string;
1672
1713
  tableFrom: string;
1673
1714
  columnsFrom: string[];
@@ -1676,6 +1717,7 @@ export declare const pgSchemaInternal: import("zod").ZodObject<{
1676
1717
  }, {
1677
1718
  onUpdate?: string | undefined;
1678
1719
  onDelete?: string | undefined;
1720
+ schemaTo?: string | undefined;
1679
1721
  name: string;
1680
1722
  tableFrom: string;
1681
1723
  columnsFrom: string[];
@@ -1725,6 +1767,7 @@ export declare const pgSchemaInternal: import("zod").ZodObject<{
1725
1767
  foreignKeys: Record<string, {
1726
1768
  onUpdate?: string | undefined;
1727
1769
  onDelete?: string | undefined;
1770
+ schemaTo?: string | undefined;
1728
1771
  name: string;
1729
1772
  tableFrom: string;
1730
1773
  columnsFrom: string[];
@@ -1766,6 +1809,7 @@ export declare const pgSchemaInternal: import("zod").ZodObject<{
1766
1809
  foreignKeys: Record<string, {
1767
1810
  onUpdate?: string | undefined;
1768
1811
  onDelete?: string | undefined;
1812
+ schemaTo?: string | undefined;
1769
1813
  name: string;
1770
1814
  tableFrom: string;
1771
1815
  columnsFrom: string[];
@@ -1879,6 +1923,7 @@ export declare const pgSchemaInternal: import("zod").ZodObject<{
1879
1923
  foreignKeys: Record<string, {
1880
1924
  onUpdate?: string | undefined;
1881
1925
  onDelete?: string | undefined;
1926
+ schemaTo?: string | undefined;
1882
1927
  name: string;
1883
1928
  tableFrom: string;
1884
1929
  columnsFrom: string[];
@@ -1943,6 +1988,7 @@ export declare const pgSchemaInternal: import("zod").ZodObject<{
1943
1988
  foreignKeys: Record<string, {
1944
1989
  onUpdate?: string | undefined;
1945
1990
  onDelete?: string | undefined;
1991
+ schemaTo?: string | undefined;
1946
1992
  name: string;
1947
1993
  tableFrom: string;
1948
1994
  columnsFrom: string[];
@@ -2281,12 +2327,14 @@ export declare const pgSchemaV3: import("zod").ZodObject<import("zod").extendSha
2281
2327
  tableFrom: import("zod").ZodString;
2282
2328
  columnsFrom: import("zod").ZodArray<import("zod").ZodString, "many">;
2283
2329
  tableTo: import("zod").ZodString;
2330
+ schemaTo: import("zod").ZodOptional<import("zod").ZodString>;
2284
2331
  columnsTo: import("zod").ZodArray<import("zod").ZodString, "many">;
2285
2332
  onUpdate: import("zod").ZodOptional<import("zod").ZodString>;
2286
2333
  onDelete: import("zod").ZodOptional<import("zod").ZodString>;
2287
2334
  }, "strict", import("zod").ZodTypeAny, {
2288
2335
  onUpdate?: string | undefined;
2289
2336
  onDelete?: string | undefined;
2337
+ schemaTo?: string | undefined;
2290
2338
  name: string;
2291
2339
  tableFrom: string;
2292
2340
  columnsFrom: string[];
@@ -2295,6 +2343,7 @@ export declare const pgSchemaV3: import("zod").ZodObject<import("zod").extendSha
2295
2343
  }, {
2296
2344
  onUpdate?: string | undefined;
2297
2345
  onDelete?: string | undefined;
2346
+ schemaTo?: string | undefined;
2298
2347
  name: string;
2299
2348
  tableFrom: string;
2300
2349
  columnsFrom: string[];
@@ -2321,6 +2370,7 @@ export declare const pgSchemaV3: import("zod").ZodObject<import("zod").extendSha
2321
2370
  foreignKeys: Record<string, {
2322
2371
  onUpdate?: string | undefined;
2323
2372
  onDelete?: string | undefined;
2373
+ schemaTo?: string | undefined;
2324
2374
  name: string;
2325
2375
  tableFrom: string;
2326
2376
  columnsFrom: string[];
@@ -2347,6 +2397,7 @@ export declare const pgSchemaV3: import("zod").ZodObject<import("zod").extendSha
2347
2397
  foreignKeys: Record<string, {
2348
2398
  onUpdate?: string | undefined;
2349
2399
  onDelete?: string | undefined;
2400
+ schemaTo?: string | undefined;
2350
2401
  name: string;
2351
2402
  tableFrom: string;
2352
2403
  columnsFrom: string[];
@@ -2392,6 +2443,7 @@ export declare const pgSchemaV3: import("zod").ZodObject<import("zod").extendSha
2392
2443
  foreignKeys: Record<string, {
2393
2444
  onUpdate?: string | undefined;
2394
2445
  onDelete?: string | undefined;
2446
+ schemaTo?: string | undefined;
2395
2447
  name: string;
2396
2448
  tableFrom: string;
2397
2449
  columnsFrom: string[];
@@ -2428,6 +2480,7 @@ export declare const pgSchemaV3: import("zod").ZodObject<import("zod").extendSha
2428
2480
  foreignKeys: Record<string, {
2429
2481
  onUpdate?: string | undefined;
2430
2482
  onDelete?: string | undefined;
2483
+ schemaTo?: string | undefined;
2431
2484
  name: string;
2432
2485
  tableFrom: string;
2433
2486
  columnsFrom: string[];
@@ -2492,12 +2545,14 @@ export declare const pgSchemaV4: import("zod").ZodObject<import("zod").extendSha
2492
2545
  tableFrom: import("zod").ZodString;
2493
2546
  columnsFrom: import("zod").ZodArray<import("zod").ZodString, "many">;
2494
2547
  tableTo: import("zod").ZodString;
2548
+ schemaTo: import("zod").ZodOptional<import("zod").ZodString>;
2495
2549
  columnsTo: import("zod").ZodArray<import("zod").ZodString, "many">;
2496
2550
  onUpdate: import("zod").ZodOptional<import("zod").ZodString>;
2497
2551
  onDelete: import("zod").ZodOptional<import("zod").ZodString>;
2498
2552
  }, "strict", import("zod").ZodTypeAny, {
2499
2553
  onUpdate?: string | undefined;
2500
2554
  onDelete?: string | undefined;
2555
+ schemaTo?: string | undefined;
2501
2556
  name: string;
2502
2557
  tableFrom: string;
2503
2558
  columnsFrom: string[];
@@ -2506,6 +2561,7 @@ export declare const pgSchemaV4: import("zod").ZodObject<import("zod").extendSha
2506
2561
  }, {
2507
2562
  onUpdate?: string | undefined;
2508
2563
  onDelete?: string | undefined;
2564
+ schemaTo?: string | undefined;
2509
2565
  name: string;
2510
2566
  tableFrom: string;
2511
2567
  columnsFrom: string[];
@@ -2532,6 +2588,7 @@ export declare const pgSchemaV4: import("zod").ZodObject<import("zod").extendSha
2532
2588
  foreignKeys: Record<string, {
2533
2589
  onUpdate?: string | undefined;
2534
2590
  onDelete?: string | undefined;
2591
+ schemaTo?: string | undefined;
2535
2592
  name: string;
2536
2593
  tableFrom: string;
2537
2594
  columnsFrom: string[];
@@ -2559,6 +2616,7 @@ export declare const pgSchemaV4: import("zod").ZodObject<import("zod").extendSha
2559
2616
  foreignKeys: Record<string, {
2560
2617
  onUpdate?: string | undefined;
2561
2618
  onDelete?: string | undefined;
2619
+ schemaTo?: string | undefined;
2562
2620
  name: string;
2563
2621
  tableFrom: string;
2564
2622
  columnsFrom: string[];
@@ -2606,6 +2664,7 @@ export declare const pgSchemaV4: import("zod").ZodObject<import("zod").extendSha
2606
2664
  foreignKeys: Record<string, {
2607
2665
  onUpdate?: string | undefined;
2608
2666
  onDelete?: string | undefined;
2667
+ schemaTo?: string | undefined;
2609
2668
  name: string;
2610
2669
  tableFrom: string;
2611
2670
  columnsFrom: string[];
@@ -2644,6 +2703,7 @@ export declare const pgSchemaV4: import("zod").ZodObject<import("zod").extendSha
2644
2703
  foreignKeys: Record<string, {
2645
2704
  onUpdate?: string | undefined;
2646
2705
  onDelete?: string | undefined;
2706
+ schemaTo?: string | undefined;
2647
2707
  name: string;
2648
2708
  tableFrom: string;
2649
2709
  columnsFrom: string[];
@@ -2710,12 +2770,14 @@ export declare const pgSchema: import("zod").ZodObject<import("zod").extendShape
2710
2770
  tableFrom: import("zod").ZodString;
2711
2771
  columnsFrom: import("zod").ZodArray<import("zod").ZodString, "many">;
2712
2772
  tableTo: import("zod").ZodString;
2773
+ schemaTo: import("zod").ZodOptional<import("zod").ZodString>;
2713
2774
  columnsTo: import("zod").ZodArray<import("zod").ZodString, "many">;
2714
2775
  onUpdate: import("zod").ZodOptional<import("zod").ZodString>;
2715
2776
  onDelete: import("zod").ZodOptional<import("zod").ZodString>;
2716
2777
  }, "strict", import("zod").ZodTypeAny, {
2717
2778
  onUpdate?: string | undefined;
2718
2779
  onDelete?: string | undefined;
2780
+ schemaTo?: string | undefined;
2719
2781
  name: string;
2720
2782
  tableFrom: string;
2721
2783
  columnsFrom: string[];
@@ -2724,6 +2786,7 @@ export declare const pgSchema: import("zod").ZodObject<import("zod").extendShape
2724
2786
  }, {
2725
2787
  onUpdate?: string | undefined;
2726
2788
  onDelete?: string | undefined;
2789
+ schemaTo?: string | undefined;
2727
2790
  name: string;
2728
2791
  tableFrom: string;
2729
2792
  columnsFrom: string[];
@@ -2773,6 +2836,7 @@ export declare const pgSchema: import("zod").ZodObject<import("zod").extendShape
2773
2836
  foreignKeys: Record<string, {
2774
2837
  onUpdate?: string | undefined;
2775
2838
  onDelete?: string | undefined;
2839
+ schemaTo?: string | undefined;
2776
2840
  name: string;
2777
2841
  tableFrom: string;
2778
2842
  columnsFrom: string[];
@@ -2814,6 +2878,7 @@ export declare const pgSchema: import("zod").ZodObject<import("zod").extendShape
2814
2878
  foreignKeys: Record<string, {
2815
2879
  onUpdate?: string | undefined;
2816
2880
  onDelete?: string | undefined;
2881
+ schemaTo?: string | undefined;
2817
2882
  name: string;
2818
2883
  tableFrom: string;
2819
2884
  columnsFrom: string[];
@@ -2932,6 +2997,7 @@ export declare const pgSchema: import("zod").ZodObject<import("zod").extendShape
2932
2997
  foreignKeys: Record<string, {
2933
2998
  onUpdate?: string | undefined;
2934
2999
  onDelete?: string | undefined;
3000
+ schemaTo?: string | undefined;
2935
3001
  name: string;
2936
3002
  tableFrom: string;
2937
3003
  columnsFrom: string[];
@@ -2998,6 +3064,7 @@ export declare const pgSchema: import("zod").ZodObject<import("zod").extendShape
2998
3064
  foreignKeys: Record<string, {
2999
3065
  onUpdate?: string | undefined;
3000
3066
  onDelete?: string | undefined;
3067
+ schemaTo?: string | undefined;
3001
3068
  name: string;
3002
3069
  tableFrom: string;
3003
3070
  columnsFrom: string[];
@@ -3429,12 +3496,14 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3429
3496
  tableFrom: import("zod").ZodString;
3430
3497
  columnsFrom: import("zod").ZodArray<import("zod").ZodString, "many">;
3431
3498
  tableTo: import("zod").ZodString;
3499
+ schemaTo: import("zod").ZodOptional<import("zod").ZodString>;
3432
3500
  columnsTo: import("zod").ZodArray<import("zod").ZodString, "many">;
3433
3501
  onUpdate: import("zod").ZodOptional<import("zod").ZodString>;
3434
3502
  onDelete: import("zod").ZodOptional<import("zod").ZodString>;
3435
3503
  }, "strict", import("zod").ZodTypeAny, {
3436
3504
  onUpdate?: string | undefined;
3437
3505
  onDelete?: string | undefined;
3506
+ schemaTo?: string | undefined;
3438
3507
  name: string;
3439
3508
  tableFrom: string;
3440
3509
  columnsFrom: string[];
@@ -3443,6 +3512,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3443
3512
  }, {
3444
3513
  onUpdate?: string | undefined;
3445
3514
  onDelete?: string | undefined;
3515
+ schemaTo?: string | undefined;
3446
3516
  name: string;
3447
3517
  tableFrom: string;
3448
3518
  columnsFrom: string[];
@@ -3469,6 +3539,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3469
3539
  foreignKeys: Record<string, {
3470
3540
  onUpdate?: string | undefined;
3471
3541
  onDelete?: string | undefined;
3542
+ schemaTo?: string | undefined;
3472
3543
  name: string;
3473
3544
  tableFrom: string;
3474
3545
  columnsFrom: string[];
@@ -3495,6 +3566,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3495
3566
  foreignKeys: Record<string, {
3496
3567
  onUpdate?: string | undefined;
3497
3568
  onDelete?: string | undefined;
3569
+ schemaTo?: string | undefined;
3498
3570
  name: string;
3499
3571
  tableFrom: string;
3500
3572
  columnsFrom: string[];
@@ -3540,6 +3612,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3540
3612
  foreignKeys: Record<string, {
3541
3613
  onUpdate?: string | undefined;
3542
3614
  onDelete?: string | undefined;
3615
+ schemaTo?: string | undefined;
3543
3616
  name: string;
3544
3617
  tableFrom: string;
3545
3618
  columnsFrom: string[];
@@ -3576,6 +3649,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3576
3649
  foreignKeys: Record<string, {
3577
3650
  onUpdate?: string | undefined;
3578
3651
  onDelete?: string | undefined;
3652
+ schemaTo?: string | undefined;
3579
3653
  name: string;
3580
3654
  tableFrom: string;
3581
3655
  columnsFrom: string[];
@@ -3639,12 +3713,14 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3639
3713
  tableFrom: import("zod").ZodString;
3640
3714
  columnsFrom: import("zod").ZodArray<import("zod").ZodString, "many">;
3641
3715
  tableTo: import("zod").ZodString;
3716
+ schemaTo: import("zod").ZodOptional<import("zod").ZodString>;
3642
3717
  columnsTo: import("zod").ZodArray<import("zod").ZodString, "many">;
3643
3718
  onUpdate: import("zod").ZodOptional<import("zod").ZodString>;
3644
3719
  onDelete: import("zod").ZodOptional<import("zod").ZodString>;
3645
3720
  }, "strict", import("zod").ZodTypeAny, {
3646
3721
  onUpdate?: string | undefined;
3647
3722
  onDelete?: string | undefined;
3723
+ schemaTo?: string | undefined;
3648
3724
  name: string;
3649
3725
  tableFrom: string;
3650
3726
  columnsFrom: string[];
@@ -3653,6 +3729,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3653
3729
  }, {
3654
3730
  onUpdate?: string | undefined;
3655
3731
  onDelete?: string | undefined;
3732
+ schemaTo?: string | undefined;
3656
3733
  name: string;
3657
3734
  tableFrom: string;
3658
3735
  columnsFrom: string[];
@@ -3679,6 +3756,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3679
3756
  foreignKeys: Record<string, {
3680
3757
  onUpdate?: string | undefined;
3681
3758
  onDelete?: string | undefined;
3759
+ schemaTo?: string | undefined;
3682
3760
  name: string;
3683
3761
  tableFrom: string;
3684
3762
  columnsFrom: string[];
@@ -3706,6 +3784,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3706
3784
  foreignKeys: Record<string, {
3707
3785
  onUpdate?: string | undefined;
3708
3786
  onDelete?: string | undefined;
3787
+ schemaTo?: string | undefined;
3709
3788
  name: string;
3710
3789
  tableFrom: string;
3711
3790
  columnsFrom: string[];
@@ -3753,6 +3832,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3753
3832
  foreignKeys: Record<string, {
3754
3833
  onUpdate?: string | undefined;
3755
3834
  onDelete?: string | undefined;
3835
+ schemaTo?: string | undefined;
3756
3836
  name: string;
3757
3837
  tableFrom: string;
3758
3838
  columnsFrom: string[];
@@ -3791,6 +3871,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3791
3871
  foreignKeys: Record<string, {
3792
3872
  onUpdate?: string | undefined;
3793
3873
  onDelete?: string | undefined;
3874
+ schemaTo?: string | undefined;
3794
3875
  name: string;
3795
3876
  tableFrom: string;
3796
3877
  columnsFrom: string[];
@@ -3856,12 +3937,14 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3856
3937
  tableFrom: import("zod").ZodString;
3857
3938
  columnsFrom: import("zod").ZodArray<import("zod").ZodString, "many">;
3858
3939
  tableTo: import("zod").ZodString;
3940
+ schemaTo: import("zod").ZodOptional<import("zod").ZodString>;
3859
3941
  columnsTo: import("zod").ZodArray<import("zod").ZodString, "many">;
3860
3942
  onUpdate: import("zod").ZodOptional<import("zod").ZodString>;
3861
3943
  onDelete: import("zod").ZodOptional<import("zod").ZodString>;
3862
3944
  }, "strict", import("zod").ZodTypeAny, {
3863
3945
  onUpdate?: string | undefined;
3864
3946
  onDelete?: string | undefined;
3947
+ schemaTo?: string | undefined;
3865
3948
  name: string;
3866
3949
  tableFrom: string;
3867
3950
  columnsFrom: string[];
@@ -3870,6 +3953,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3870
3953
  }, {
3871
3954
  onUpdate?: string | undefined;
3872
3955
  onDelete?: string | undefined;
3956
+ schemaTo?: string | undefined;
3873
3957
  name: string;
3874
3958
  tableFrom: string;
3875
3959
  columnsFrom: string[];
@@ -3919,6 +4003,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3919
4003
  foreignKeys: Record<string, {
3920
4004
  onUpdate?: string | undefined;
3921
4005
  onDelete?: string | undefined;
4006
+ schemaTo?: string | undefined;
3922
4007
  name: string;
3923
4008
  tableFrom: string;
3924
4009
  columnsFrom: string[];
@@ -3960,6 +4045,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3960
4045
  foreignKeys: Record<string, {
3961
4046
  onUpdate?: string | undefined;
3962
4047
  onDelete?: string | undefined;
4048
+ schemaTo?: string | undefined;
3963
4049
  name: string;
3964
4050
  tableFrom: string;
3965
4051
  columnsFrom: string[];
@@ -4078,6 +4164,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
4078
4164
  foreignKeys: Record<string, {
4079
4165
  onUpdate?: string | undefined;
4080
4166
  onDelete?: string | undefined;
4167
+ schemaTo?: string | undefined;
4081
4168
  name: string;
4082
4169
  tableFrom: string;
4083
4170
  columnsFrom: string[];
@@ -4144,6 +4231,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
4144
4231
  foreignKeys: Record<string, {
4145
4232
  onUpdate?: string | undefined;
4146
4233
  onDelete?: string | undefined;
4234
+ schemaTo?: string | undefined;
4147
4235
  name: string;
4148
4236
  tableFrom: string;
4149
4237
  columnsFrom: string[];
@@ -4213,6 +4301,7 @@ export declare const dryPg: {
4213
4301
  foreignKeys: Record<string, {
4214
4302
  onUpdate?: string | undefined;
4215
4303
  onDelete?: string | undefined;
4304
+ schemaTo?: string | undefined;
4216
4305
  name: string;
4217
4306
  tableFrom: string;
4218
4307
  columnsFrom: string[];
package/utils-studio.js CHANGED
@@ -1650,24 +1650,29 @@ var init_pgSerializer = __esm({
1650
1650
  }
1651
1651
  const tableForeignKeys = await db.query(
1652
1652
  `SELECT
1653
- tc.table_schema,
1654
- tc.constraint_name,
1655
- tc.table_name,
1656
- kcu.column_name,
1657
- ccu.table_schema AS foreign_table_schema,
1658
- ccu.table_name AS foreign_table_name,
1659
- ccu.column_name AS foreign_column_name,
1660
- rc.delete_rule, rc.update_rule
1661
- FROM
1662
- information_schema.table_constraints AS tc
1663
- JOIN information_schema.key_column_usage AS kcu
1664
- ON tc.constraint_name = kcu.constraint_name
1665
- AND tc.table_schema = kcu.table_schema
1666
- JOIN information_schema.constraint_column_usage AS ccu
1667
- ON ccu.constraint_name = tc.constraint_name
1668
- AND ccu.table_schema = tc.table_schema
1669
- JOIN information_schema.referential_constraints AS rc
1670
- ON ccu.constraint_name = rc.constraint_name
1653
+ tc.table_schema,
1654
+ tc.constraint_name,
1655
+ tc.table_name,
1656
+ kcu.column_name,
1657
+ (
1658
+ SELECT ccu.table_schema
1659
+ FROM information_schema.constraint_column_usage ccu
1660
+ WHERE ccu.constraint_name = tc.constraint_name
1661
+ LIMIT 1
1662
+ ) AS foreign_table_schema,
1663
+ ccu.table_name AS foreign_table_name,
1664
+ ccu.column_name AS foreign_column_name,
1665
+ rc.delete_rule,
1666
+ rc.update_rule
1667
+ FROM
1668
+ information_schema.table_constraints AS tc
1669
+ JOIN information_schema.key_column_usage AS kcu
1670
+ ON tc.constraint_name = kcu.constraint_name
1671
+ AND tc.table_schema = kcu.table_schema
1672
+ JOIN information_schema.constraint_column_usage AS ccu
1673
+ ON ccu.constraint_name = tc.constraint_name
1674
+ JOIN information_schema.referential_constraints AS rc
1675
+ ON ccu.constraint_name = rc.constraint_name
1671
1676
  WHERE tc.constraint_type = 'FOREIGN KEY' AND tc.table_name='${tableName}' and tc.table_schema='${tableSchema}';`
1672
1677
  );
1673
1678
  foreignKeysCount += tableForeignKeys.length;
@@ -1678,6 +1683,7 @@ var init_pgSerializer = __esm({
1678
1683
  const columnFrom = fk.column_name;
1679
1684
  const tableTo = fk.foreign_table_name;
1680
1685
  const columnTo = fk.foreign_column_name;
1686
+ const schemaTo = fk.foreign_table_schema;
1681
1687
  const foreignKeyName = fk.constraint_name;
1682
1688
  const onUpdate = fk.update_rule.toLowerCase();
1683
1689
  const onDelete = fk.delete_rule.toLowerCase();
@@ -1689,6 +1695,7 @@ var init_pgSerializer = __esm({
1689
1695
  name: foreignKeyName,
1690
1696
  tableFrom: tableName,
1691
1697
  tableTo,
1698
+ schemaTo,
1692
1699
  columnsFrom: [columnFrom],
1693
1700
  columnsTo: [columnTo],
1694
1701
  onDelete,
package/utils-studio.mjs CHANGED
@@ -1659,24 +1659,29 @@ var init_pgSerializer = __esm({
1659
1659
  }
1660
1660
  const tableForeignKeys = await db.query(
1661
1661
  `SELECT
1662
- tc.table_schema,
1663
- tc.constraint_name,
1664
- tc.table_name,
1665
- kcu.column_name,
1666
- ccu.table_schema AS foreign_table_schema,
1667
- ccu.table_name AS foreign_table_name,
1668
- ccu.column_name AS foreign_column_name,
1669
- rc.delete_rule, rc.update_rule
1670
- FROM
1671
- information_schema.table_constraints AS tc
1672
- JOIN information_schema.key_column_usage AS kcu
1673
- ON tc.constraint_name = kcu.constraint_name
1674
- AND tc.table_schema = kcu.table_schema
1675
- JOIN information_schema.constraint_column_usage AS ccu
1676
- ON ccu.constraint_name = tc.constraint_name
1677
- AND ccu.table_schema = tc.table_schema
1678
- JOIN information_schema.referential_constraints AS rc
1679
- ON ccu.constraint_name = rc.constraint_name
1662
+ tc.table_schema,
1663
+ tc.constraint_name,
1664
+ tc.table_name,
1665
+ kcu.column_name,
1666
+ (
1667
+ SELECT ccu.table_schema
1668
+ FROM information_schema.constraint_column_usage ccu
1669
+ WHERE ccu.constraint_name = tc.constraint_name
1670
+ LIMIT 1
1671
+ ) AS foreign_table_schema,
1672
+ ccu.table_name AS foreign_table_name,
1673
+ ccu.column_name AS foreign_column_name,
1674
+ rc.delete_rule,
1675
+ rc.update_rule
1676
+ FROM
1677
+ information_schema.table_constraints AS tc
1678
+ JOIN information_schema.key_column_usage AS kcu
1679
+ ON tc.constraint_name = kcu.constraint_name
1680
+ AND tc.table_schema = kcu.table_schema
1681
+ JOIN information_schema.constraint_column_usage AS ccu
1682
+ ON ccu.constraint_name = tc.constraint_name
1683
+ JOIN information_schema.referential_constraints AS rc
1684
+ ON ccu.constraint_name = rc.constraint_name
1680
1685
  WHERE tc.constraint_type = 'FOREIGN KEY' AND tc.table_name='${tableName}' and tc.table_schema='${tableSchema}';`
1681
1686
  );
1682
1687
  foreignKeysCount += tableForeignKeys.length;
@@ -1687,6 +1692,7 @@ var init_pgSerializer = __esm({
1687
1692
  const columnFrom = fk.column_name;
1688
1693
  const tableTo = fk.foreign_table_name;
1689
1694
  const columnTo = fk.foreign_column_name;
1695
+ const schemaTo = fk.foreign_table_schema;
1690
1696
  const foreignKeyName = fk.constraint_name;
1691
1697
  const onUpdate = fk.update_rule.toLowerCase();
1692
1698
  const onDelete = fk.delete_rule.toLowerCase();
@@ -1698,6 +1704,7 @@ var init_pgSerializer = __esm({
1698
1704
  name: foreignKeyName,
1699
1705
  tableFrom: tableName,
1700
1706
  tableTo,
1707
+ schemaTo,
1701
1708
  columnsFrom: [columnFrom],
1702
1709
  columnsTo: [columnTo],
1703
1710
  onDelete,
package/utils.d.ts CHANGED
@@ -101,6 +101,7 @@ export declare const statementsForDiffs: (in1: any, in2: any) => Promise<{
101
101
  foreignKeys: Record<string, {
102
102
  onUpdate?: string | undefined;
103
103
  onDelete?: string | undefined;
104
+ schemaTo?: string | undefined;
104
105
  name: string;
105
106
  tableFrom: string;
106
107
  columnsFrom: string[];
@@ -163,6 +164,7 @@ export declare const statementsForDiffs: (in1: any, in2: any) => Promise<{
163
164
  foreignKeys: Record<string, {
164
165
  onUpdate?: string | undefined;
165
166
  onDelete?: string | undefined;
167
+ schemaTo?: string | undefined;
166
168
  name: string;
167
169
  tableFrom: string;
168
170
  columnsFrom: string[];
package/utils.js CHANGED
@@ -4817,6 +4817,7 @@ var init_pgSchema = __esm({
4817
4817
  tableFrom: stringType(),
4818
4818
  columnsFrom: stringType().array(),
4819
4819
  tableTo: stringType(),
4820
+ schemaTo: stringType().optional(),
4820
4821
  columnsTo: stringType().array(),
4821
4822
  onUpdate: stringType().optional(),
4822
4823
  onDelete: stringType().optional()
@@ -4974,7 +4975,7 @@ var init_pgSchema = __esm({
4974
4975
  return result;
4975
4976
  },
4976
4977
  squashFK: (fk4) => {
4977
- return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${fk4.onUpdate ?? ""};${fk4.onDelete ?? ""}`;
4978
+ return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${fk4.onUpdate ?? ""};${fk4.onDelete ?? ""};${fk4.schemaTo ?? ""}`;
4978
4979
  },
4979
4980
  squashPK: (pk) => {
4980
4981
  return `${pk.columns.join(",")};${pk.name}`;
@@ -5002,12 +5003,14 @@ var init_pgSchema = __esm({
5002
5003
  tableTo,
5003
5004
  columnsToStr,
5004
5005
  onUpdate,
5005
- onDelete
5006
+ onDelete,
5007
+ schemaTo
5006
5008
  ] = input.split(";");
5007
5009
  const result = fk2.parse({
5008
5010
  name,
5009
5011
  tableFrom,
5010
5012
  columnsFrom: columnsFromStr.split(","),
5013
+ schemaTo,
5011
5014
  tableTo,
5012
5015
  columnsTo: columnsToStr.split(","),
5013
5016
  onUpdate,
@@ -12038,12 +12041,14 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
12038
12041
  const onUpdate = fk4.onUpdate;
12039
12042
  const reference = fk4.reference();
12040
12043
  const tableTo = (0, import_drizzle_orm5.getTableName)(reference.foreignTable);
12044
+ const schemaTo = (0, import_pg_core3.getTableConfig)(reference.foreignTable).schema;
12041
12045
  const columnsFrom = reference.columns.map((it) => it.name);
12042
12046
  const columnsTo = reference.foreignColumns.map((it) => it.name);
12043
12047
  return {
12044
12048
  name,
12045
12049
  tableFrom,
12046
12050
  tableTo,
12051
+ schemaTo: schemaTo ?? "public",
12047
12052
  columnsFrom,
12048
12053
  columnsTo,
12049
12054
  onDelete,
@@ -12220,24 +12225,29 @@ ${withStyle.errorWarning(
12220
12225
  }
12221
12226
  const tableForeignKeys = await db.query(
12222
12227
  `SELECT
12223
- tc.table_schema,
12224
- tc.constraint_name,
12225
- tc.table_name,
12226
- kcu.column_name,
12227
- ccu.table_schema AS foreign_table_schema,
12228
- ccu.table_name AS foreign_table_name,
12229
- ccu.column_name AS foreign_column_name,
12230
- rc.delete_rule, rc.update_rule
12231
- FROM
12232
- information_schema.table_constraints AS tc
12233
- JOIN information_schema.key_column_usage AS kcu
12234
- ON tc.constraint_name = kcu.constraint_name
12235
- AND tc.table_schema = kcu.table_schema
12236
- JOIN information_schema.constraint_column_usage AS ccu
12237
- ON ccu.constraint_name = tc.constraint_name
12238
- AND ccu.table_schema = tc.table_schema
12239
- JOIN information_schema.referential_constraints AS rc
12240
- ON ccu.constraint_name = rc.constraint_name
12228
+ tc.table_schema,
12229
+ tc.constraint_name,
12230
+ tc.table_name,
12231
+ kcu.column_name,
12232
+ (
12233
+ SELECT ccu.table_schema
12234
+ FROM information_schema.constraint_column_usage ccu
12235
+ WHERE ccu.constraint_name = tc.constraint_name
12236
+ LIMIT 1
12237
+ ) AS foreign_table_schema,
12238
+ ccu.table_name AS foreign_table_name,
12239
+ ccu.column_name AS foreign_column_name,
12240
+ rc.delete_rule,
12241
+ rc.update_rule
12242
+ FROM
12243
+ information_schema.table_constraints AS tc
12244
+ JOIN information_schema.key_column_usage AS kcu
12245
+ ON tc.constraint_name = kcu.constraint_name
12246
+ AND tc.table_schema = kcu.table_schema
12247
+ JOIN information_schema.constraint_column_usage AS ccu
12248
+ ON ccu.constraint_name = tc.constraint_name
12249
+ JOIN information_schema.referential_constraints AS rc
12250
+ ON ccu.constraint_name = rc.constraint_name
12241
12251
  WHERE tc.constraint_type = 'FOREIGN KEY' AND tc.table_name='${tableName}' and tc.table_schema='${tableSchema}';`
12242
12252
  );
12243
12253
  foreignKeysCount += tableForeignKeys.length;
@@ -12248,6 +12258,7 @@ ${withStyle.errorWarning(
12248
12258
  const columnFrom = fk4.column_name;
12249
12259
  const tableTo = fk4.foreign_table_name;
12250
12260
  const columnTo = fk4.foreign_column_name;
12261
+ const schemaTo = fk4.foreign_table_schema;
12251
12262
  const foreignKeyName = fk4.constraint_name;
12252
12263
  const onUpdate = fk4.update_rule.toLowerCase();
12253
12264
  const onDelete = fk4.delete_rule.toLowerCase();
@@ -12259,6 +12270,7 @@ ${withStyle.errorWarning(
12259
12270
  name: foreignKeyName,
12260
12271
  tableFrom: tableName,
12261
12272
  tableTo,
12273
+ schemaTo,
12262
12274
  columnsFrom: [columnFrom],
12263
12275
  columnsTo: [columnTo],
12264
12276
  onDelete,
@@ -15883,14 +15895,15 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
15883
15895
  columnsFrom,
15884
15896
  columnsTo,
15885
15897
  onDelete,
15886
- onUpdate
15898
+ onUpdate,
15899
+ schemaTo
15887
15900
  } = PgSquasher.unsquashFK(statement.data);
15888
15901
  const onDeleteStatement = onDelete ? ` ON DELETE ${onDelete}` : "";
15889
15902
  const onUpdateStatement = onUpdate ? ` ON UPDATE ${onUpdate}` : "";
15890
15903
  const fromColumnsString = columnsFrom.map((it) => `"${it}"`).join(",");
15891
15904
  const toColumnsString = columnsTo.map((it) => `"${it}"`).join(",");
15892
15905
  const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${tableFrom}"` : `"${tableFrom}"`;
15893
- const tableToNameWithSchema = statement.schema ? `"${statement.schema}"."${tableTo}"` : `"${tableTo}"`;
15906
+ const tableToNameWithSchema = schemaTo ? `"${schemaTo}"."${tableTo}"` : `"${tableTo}"`;
15894
15907
  const alterStatement = `ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${name}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement}`;
15895
15908
  let sql2 = "DO $$ BEGIN\n";
15896
15909
  sql2 += " " + alterStatement + ";\n";
@@ -15949,8 +15962,9 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
15949
15962
  const onUpdateStatement = newFk.onUpdate ? ` ON UPDATE ${newFk.onUpdate}` : "";
15950
15963
  const fromColumnsString = newFk.columnsFrom.map((it) => `"${it}"`).join(",");
15951
15964
  const toColumnsString = newFk.columnsTo.map((it) => `"${it}"`).join(",");
15952
- const tableFromNameWithSchema = statement.schema ? `"${statement.schema}"."${newFk.tableFrom}"` : `"${newFk.tableFrom}"`;
15953
- const alterStatement = `ALTER TABLE ${tableFromNameWithSchema} ADD CONSTRAINT "${newFk.name}" FOREIGN KEY (${fromColumnsString}) REFERENCES "${newFk.tableTo}"(${toColumnsString})${onDeleteStatement}${onUpdateStatement}`;
15965
+ const tableFromNameWithSchema = oldFk.schemaTo ? `"${oldFk.schemaTo}"."${oldFk.tableFrom}"` : `"${oldFk.tableFrom}"`;
15966
+ const tableToNameWithSchema = newFk.schemaTo ? `"${newFk.schemaTo}"."${newFk.tableFrom}"` : `"${newFk.tableFrom}"`;
15967
+ const alterStatement = `ALTER TABLE ${tableFromNameWithSchema} ADD CONSTRAINT "${newFk.name}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement}`;
15954
15968
  sql2 += "DO $$ BEGIN\n";
15955
15969
  sql2 += " " + alterStatement + ";\n";
15956
15970
  sql2 += "EXCEPTION\n";
@@ -17947,7 +17961,7 @@ var init_introspect_pg = __esm({
17947
17961
  const schemaStatements = Object.entries(schemas).map((it) => {
17948
17962
  return `export const ${it[1]} = pgSchema("${it[0]}");
17949
17963
  `;
17950
- }).join();
17964
+ }).join("");
17951
17965
  const tableStatements = Object.values(schema4.tables).map((table4) => {
17952
17966
  const tableSchema = schemas[table4.schema];
17953
17967
  const func = tableSchema ? `${tableSchema}.table` : "pgTable";