drizzle-kit 0.20.9 → 0.20.10-b4cd19e

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(),
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,
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 = statement.schema ? `"${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";
@@ -19034,7 +19047,7 @@ var init_introspect_pg = __esm({
19034
19047
  const schemaStatements = Object.entries(schemas).map((it) => {
19035
19048
  return `export const ${it[1]} = pgSchema("${it[0]}");
19036
19049
  `;
19037
- }).join();
19050
+ }).join("");
19038
19051
  const tableStatements = Object.values(schema4.tables).map((table4) => {
19039
19052
  const tableSchema = schemas[table4.schema];
19040
19053
  const func = tableSchema ? `${tableSchema}.table` : "pgTable";
@@ -62069,7 +62082,7 @@ init_source();
62069
62082
  // package.json
62070
62083
  var package_default = {
62071
62084
  name: "drizzle-kit",
62072
- version: "0.20.9",
62085
+ version: "0.20.10",
62073
62086
  repository: "https://github.com/drizzle-team/drizzle-kit-mirror",
62074
62087
  author: "Drizzle Team",
62075
62088
  license: "MIT",
@@ -63494,15 +63507,15 @@ var introspectPgCommand = new import_commander.Command("introspect:pg").option("
63494
63507
  dryMySql,
63495
63508
  schema4
63496
63509
  );
63497
- writeResult(
63498
- schema4,
63510
+ writeResult({
63511
+ cur: schema4,
63499
63512
  sqlStatements,
63500
63513
  journal,
63501
63514
  _meta,
63502
- validatedConfig.out,
63503
- validatedConfig.breakpoints,
63504
- "introspect"
63505
- );
63515
+ outFolder: validatedConfig.out,
63516
+ breakpoints: validatedConfig.breakpoints,
63517
+ type: "introspect"
63518
+ });
63506
63519
  } else {
63507
63520
  (0, import_hanji11.render)(
63508
63521
  `[${source_default.blue(
@@ -63547,15 +63560,15 @@ var introspectMySqlCommand = new import_commander.Command("introspect:mysql").op
63547
63560
  dryMySql,
63548
63561
  schema4
63549
63562
  );
63550
- writeResult(
63551
- schema4,
63563
+ writeResult({
63564
+ cur: schema4,
63552
63565
  sqlStatements,
63553
63566
  journal,
63554
63567
  _meta,
63555
- out,
63556
- res.breakpoints ?? false,
63557
- "introspect"
63558
- );
63568
+ outFolder: out,
63569
+ breakpoints: res.breakpoints ?? false,
63570
+ type: "introspect"
63571
+ });
63559
63572
  } else {
63560
63573
  (0, import_hanji11.render)(
63561
63574
  `[${source_default.blue(
@@ -63600,15 +63613,15 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
63600
63613
  drySQLite,
63601
63614
  schema4
63602
63615
  );
63603
- writeResult(
63604
- schema4,
63616
+ writeResult({
63617
+ cur: schema4,
63605
63618
  sqlStatements,
63606
63619
  journal,
63607
63620
  _meta,
63608
- out,
63609
- res.breakpoints ?? false,
63610
- "introspect"
63611
- );
63621
+ outFolder: out,
63622
+ breakpoints: res.breakpoints ?? false,
63623
+ type: "introspect"
63624
+ });
63612
63625
  } else {
63613
63626
  (0, import_hanji11.render)(
63614
63627
  `[${source_default.blue(
@@ -63642,7 +63655,9 @@ var dropCommand = new import_commander.Command("drop").option("--out <out>", `Ou
63642
63655
  if (typeof options.driver !== "undefined") {
63643
63656
  bundle = options.driver === "expo";
63644
63657
  } else {
63645
- const drizzleConfig = await drizzleConfigFromFile(options.config);
63658
+ const drizzleConfig = await drizzleConfigFromFile(
63659
+ options.config
63660
+ );
63646
63661
  bundle = drizzleConfig.driver === "expo";
63647
63662
  }
63648
63663
  assertV1OutFolder(out, "{dialect}");
@@ -34,6 +34,7 @@ export declare const pgPushIntrospect: (connection: {
34
34
  columnsFrom: string[];
35
35
  tableTo: string;
36
36
  columnsTo: string[];
37
+ schemaTo: string;
37
38
  }>;
38
39
  schema: string;
39
40
  compositePrimaryKeys: Record<string, {
@@ -89,6 +90,7 @@ export declare const pgIntrospect: (config: PgConfigIntrospect, filters: string[
89
90
  columnsFrom: string[];
90
91
  tableTo: string;
91
92
  columnsTo: string[];
93
+ schemaTo: string;
92
94
  }>;
93
95
  schema: string;
94
96
  compositePrimaryKeys: Record<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-b4cd19e",
4
4
  "repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
5
5
  "author": "Drizzle Team",
6
6
  "license": "MIT",
@@ -400,6 +400,7 @@ 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").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>;
@@ -411,6 +412,7 @@ declare const commonSchema: import("zod").ZodUnion<[import("zod").ZodObject<impo
411
412
  columnsFrom: string[];
412
413
  tableTo: string;
413
414
  columnsTo: string[];
415
+ schemaTo: string;
414
416
  }, {
415
417
  onUpdate?: string | undefined;
416
418
  onDelete?: string | undefined;
@@ -419,6 +421,7 @@ declare const commonSchema: import("zod").ZodUnion<[import("zod").ZodObject<impo
419
421
  columnsFrom: string[];
420
422
  tableTo: string;
421
423
  columnsTo: string[];
424
+ schemaTo: string;
422
425
  }>>;
423
426
  compositePrimaryKeys: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
424
427
  name: import("zod").ZodString;
@@ -468,6 +471,7 @@ declare const commonSchema: import("zod").ZodUnion<[import("zod").ZodObject<impo
468
471
  columnsFrom: string[];
469
472
  tableTo: string;
470
473
  columnsTo: string[];
474
+ schemaTo: string;
471
475
  }>;
472
476
  schema: string;
473
477
  compositePrimaryKeys: Record<string, {
@@ -509,6 +513,7 @@ declare const commonSchema: import("zod").ZodUnion<[import("zod").ZodObject<impo
509
513
  columnsFrom: string[];
510
514
  tableTo: string;
511
515
  columnsTo: string[];
516
+ schemaTo: string;
512
517
  }>;
513
518
  schema: string;
514
519
  compositePrimaryKeys: Record<string, {
@@ -627,6 +632,7 @@ declare const commonSchema: import("zod").ZodUnion<[import("zod").ZodObject<impo
627
632
  columnsFrom: string[];
628
633
  tableTo: string;
629
634
  columnsTo: string[];
635
+ schemaTo: string;
630
636
  }>;
631
637
  schema: string;
632
638
  compositePrimaryKeys: Record<string, {
@@ -693,6 +699,7 @@ declare const commonSchema: import("zod").ZodUnion<[import("zod").ZodObject<impo
693
699
  columnsFrom: string[];
694
700
  tableTo: string;
695
701
  columnsTo: string[];
702
+ schemaTo: string;
696
703
  }>;
697
704
  schema: string;
698
705
  compositePrimaryKeys: Record<string, {
@@ -367,6 +367,7 @@ 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").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>;
@@ -378,6 +379,7 @@ declare const fk: import("zod").ZodObject<{
378
379
  columnsFrom: string[];
379
380
  tableTo: string;
380
381
  columnsTo: string[];
382
+ schemaTo: string;
381
383
  }, {
382
384
  onUpdate?: string | undefined;
383
385
  onDelete?: string | undefined;
@@ -386,6 +388,7 @@ declare const fk: import("zod").ZodObject<{
386
388
  columnsFrom: string[];
387
389
  tableTo: string;
388
390
  columnsTo: string[];
391
+ schemaTo: string;
389
392
  }>;
390
393
  declare const column: import("zod").ZodObject<{
391
394
  name: import("zod").ZodString;
@@ -463,6 +466,7 @@ 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").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>;
@@ -474,6 +478,7 @@ declare const tableV3: import("zod").ZodObject<{
474
478
  columnsFrom: string[];
475
479
  tableTo: string;
476
480
  columnsTo: string[];
481
+ schemaTo: string;
477
482
  }, {
478
483
  onUpdate?: string | undefined;
479
484
  onDelete?: string | undefined;
@@ -482,6 +487,7 @@ declare const tableV3: import("zod").ZodObject<{
482
487
  columnsFrom: string[];
483
488
  tableTo: string;
484
489
  columnsTo: string[];
490
+ schemaTo: string;
485
491
  }>>;
486
492
  }, "strict", import("zod").ZodTypeAny, {
487
493
  name: string;
@@ -508,6 +514,7 @@ declare const tableV3: import("zod").ZodObject<{
508
514
  columnsFrom: string[];
509
515
  tableTo: string;
510
516
  columnsTo: string[];
517
+ schemaTo: string;
511
518
  }>;
512
519
  }, {
513
520
  name: string;
@@ -534,6 +541,7 @@ declare const tableV3: import("zod").ZodObject<{
534
541
  columnsFrom: string[];
535
542
  tableTo: string;
536
543
  columnsTo: string[];
544
+ schemaTo: string;
537
545
  }>;
538
546
  }>;
539
547
  declare const compositePK: import("zod").ZodObject<{
@@ -608,6 +616,7 @@ 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").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>;
@@ -619,6 +628,7 @@ declare const tableV4: import("zod").ZodObject<{
619
628
  columnsFrom: string[];
620
629
  tableTo: string;
621
630
  columnsTo: string[];
631
+ schemaTo: string;
622
632
  }, {
623
633
  onUpdate?: string | undefined;
624
634
  onDelete?: string | undefined;
@@ -627,6 +637,7 @@ declare const tableV4: import("zod").ZodObject<{
627
637
  columnsFrom: string[];
628
638
  tableTo: string;
629
639
  columnsTo: string[];
640
+ schemaTo: string;
630
641
  }>>;
631
642
  }, "strict", import("zod").ZodTypeAny, {
632
643
  name: string;
@@ -653,6 +664,7 @@ declare const tableV4: import("zod").ZodObject<{
653
664
  columnsFrom: string[];
654
665
  tableTo: string;
655
666
  columnsTo: string[];
667
+ schemaTo: string;
656
668
  }>;
657
669
  schema: string;
658
670
  }, {
@@ -680,6 +692,7 @@ declare const tableV4: import("zod").ZodObject<{
680
692
  columnsFrom: string[];
681
693
  tableTo: string;
682
694
  columnsTo: string[];
695
+ schemaTo: string;
683
696
  }>;
684
697
  schema: string;
685
698
  }>;
@@ -732,6 +745,7 @@ 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").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>;
@@ -743,6 +757,7 @@ declare const table: import("zod").ZodObject<{
743
757
  columnsFrom: string[];
744
758
  tableTo: string;
745
759
  columnsTo: string[];
760
+ schemaTo: string;
746
761
  }, {
747
762
  onUpdate?: string | undefined;
748
763
  onDelete?: string | undefined;
@@ -751,6 +766,7 @@ declare const table: import("zod").ZodObject<{
751
766
  columnsFrom: string[];
752
767
  tableTo: string;
753
768
  columnsTo: string[];
769
+ schemaTo: string;
754
770
  }>>;
755
771
  compositePrimaryKeys: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
756
772
  name: import("zod").ZodString;
@@ -800,6 +816,7 @@ declare const table: import("zod").ZodObject<{
800
816
  columnsFrom: string[];
801
817
  tableTo: string;
802
818
  columnsTo: string[];
819
+ schemaTo: string;
803
820
  }>;
804
821
  schema: string;
805
822
  compositePrimaryKeys: Record<string, {
@@ -841,6 +858,7 @@ declare const table: import("zod").ZodObject<{
841
858
  columnsFrom: string[];
842
859
  tableTo: string;
843
860
  columnsTo: string[];
861
+ schemaTo: string;
844
862
  }>;
845
863
  schema: string;
846
864
  compositePrimaryKeys: Record<string, {
@@ -899,6 +917,7 @@ 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").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>;
@@ -910,6 +929,7 @@ export declare const pgSchemaInternalV3: import("zod").ZodObject<{
910
929
  columnsFrom: string[];
911
930
  tableTo: string;
912
931
  columnsTo: string[];
932
+ schemaTo: string;
913
933
  }, {
914
934
  onUpdate?: string | undefined;
915
935
  onDelete?: string | undefined;
@@ -918,6 +938,7 @@ export declare const pgSchemaInternalV3: import("zod").ZodObject<{
918
938
  columnsFrom: string[];
919
939
  tableTo: string;
920
940
  columnsTo: string[];
941
+ schemaTo: string;
921
942
  }>>;
922
943
  }, "strict", import("zod").ZodTypeAny, {
923
944
  name: string;
@@ -944,6 +965,7 @@ export declare const pgSchemaInternalV3: import("zod").ZodObject<{
944
965
  columnsFrom: string[];
945
966
  tableTo: string;
946
967
  columnsTo: string[];
968
+ schemaTo: string;
947
969
  }>;
948
970
  }, {
949
971
  name: string;
@@ -970,6 +992,7 @@ export declare const pgSchemaInternalV3: import("zod").ZodObject<{
970
992
  columnsFrom: string[];
971
993
  tableTo: string;
972
994
  columnsTo: string[];
995
+ schemaTo: string;
973
996
  }>;
974
997
  }>>;
975
998
  enums: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
@@ -1010,6 +1033,7 @@ export declare const pgSchemaInternalV3: import("zod").ZodObject<{
1010
1033
  columnsFrom: string[];
1011
1034
  tableTo: string;
1012
1035
  columnsTo: string[];
1036
+ schemaTo: string;
1013
1037
  }>;
1014
1038
  }>;
1015
1039
  enums: Record<string, {
@@ -1044,6 +1068,7 @@ export declare const pgSchemaInternalV3: import("zod").ZodObject<{
1044
1068
  columnsFrom: string[];
1045
1069
  tableTo: string;
1046
1070
  columnsTo: string[];
1071
+ schemaTo: string;
1047
1072
  }>;
1048
1073
  }>;
1049
1074
  enums: Record<string, {
@@ -1103,6 +1128,7 @@ 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").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>;
@@ -1114,6 +1140,7 @@ export declare const pgSchemaInternalV4: import("zod").ZodObject<{
1114
1140
  columnsFrom: string[];
1115
1141
  tableTo: string;
1116
1142
  columnsTo: string[];
1143
+ schemaTo: string;
1117
1144
  }, {
1118
1145
  onUpdate?: string | undefined;
1119
1146
  onDelete?: string | undefined;
@@ -1122,6 +1149,7 @@ export declare const pgSchemaInternalV4: import("zod").ZodObject<{
1122
1149
  columnsFrom: string[];
1123
1150
  tableTo: string;
1124
1151
  columnsTo: string[];
1152
+ schemaTo: string;
1125
1153
  }>>;
1126
1154
  }, "strict", import("zod").ZodTypeAny, {
1127
1155
  name: string;
@@ -1148,6 +1176,7 @@ export declare const pgSchemaInternalV4: import("zod").ZodObject<{
1148
1176
  columnsFrom: string[];
1149
1177
  tableTo: string;
1150
1178
  columnsTo: string[];
1179
+ schemaTo: string;
1151
1180
  }>;
1152
1181
  schema: string;
1153
1182
  }, {
@@ -1175,6 +1204,7 @@ export declare const pgSchemaInternalV4: import("zod").ZodObject<{
1175
1204
  columnsFrom: string[];
1176
1205
  tableTo: string;
1177
1206
  columnsTo: string[];
1207
+ schemaTo: string;
1178
1208
  }>;
1179
1209
  schema: string;
1180
1210
  }>>;
@@ -1217,6 +1247,7 @@ export declare const pgSchemaInternalV4: import("zod").ZodObject<{
1217
1247
  columnsFrom: string[];
1218
1248
  tableTo: string;
1219
1249
  columnsTo: string[];
1250
+ schemaTo: string;
1220
1251
  }>;
1221
1252
  schema: string;
1222
1253
  }>;
@@ -1253,6 +1284,7 @@ export declare const pgSchemaInternalV4: import("zod").ZodObject<{
1253
1284
  columnsFrom: string[];
1254
1285
  tableTo: string;
1255
1286
  columnsTo: string[];
1287
+ schemaTo: string;
1256
1288
  }>;
1257
1289
  schema: string;
1258
1290
  }>;
@@ -1314,6 +1346,7 @@ 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").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>;
@@ -1325,6 +1358,7 @@ export declare const pgSchemaExternal: import("zod").ZodObject<{
1325
1358
  columnsFrom: string[];
1326
1359
  tableTo: string;
1327
1360
  columnsTo: string[];
1361
+ schemaTo: string;
1328
1362
  }, {
1329
1363
  onUpdate?: string | undefined;
1330
1364
  onDelete?: string | undefined;
@@ -1333,6 +1367,7 @@ export declare const pgSchemaExternal: import("zod").ZodObject<{
1333
1367
  columnsFrom: string[];
1334
1368
  tableTo: string;
1335
1369
  columnsTo: string[];
1370
+ schemaTo: string;
1336
1371
  }>>;
1337
1372
  compositePrimaryKeys: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
1338
1373
  name: import("zod").ZodString;
@@ -1382,6 +1417,7 @@ export declare const pgSchemaExternal: import("zod").ZodObject<{
1382
1417
  columnsFrom: string[];
1383
1418
  tableTo: string;
1384
1419
  columnsTo: string[];
1420
+ schemaTo: string;
1385
1421
  }>;
1386
1422
  schema: string;
1387
1423
  compositePrimaryKeys: Record<string, {
@@ -1423,6 +1459,7 @@ export declare const pgSchemaExternal: import("zod").ZodObject<{
1423
1459
  columnsFrom: string[];
1424
1460
  tableTo: string;
1425
1461
  columnsTo: string[];
1462
+ schemaTo: string;
1426
1463
  }>;
1427
1464
  schema: string;
1428
1465
  compositePrimaryKeys: Record<string, {
@@ -1488,6 +1525,7 @@ export declare const pgSchemaExternal: import("zod").ZodObject<{
1488
1525
  columnsFrom: string[];
1489
1526
  tableTo: string;
1490
1527
  columnsTo: string[];
1528
+ schemaTo: string;
1491
1529
  }>;
1492
1530
  schema: string;
1493
1531
  compositePrimaryKeys: Record<string, {
@@ -1545,6 +1583,7 @@ export declare const pgSchemaExternal: import("zod").ZodObject<{
1545
1583
  columnsFrom: string[];
1546
1584
  tableTo: string;
1547
1585
  columnsTo: string[];
1586
+ schemaTo: string;
1548
1587
  }>;
1549
1588
  schema: string;
1550
1589
  compositePrimaryKeys: Record<string, {
@@ -1662,6 +1701,7 @@ 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").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>;
@@ -1673,6 +1713,7 @@ export declare const pgSchemaInternal: import("zod").ZodObject<{
1673
1713
  columnsFrom: string[];
1674
1714
  tableTo: string;
1675
1715
  columnsTo: string[];
1716
+ schemaTo: string;
1676
1717
  }, {
1677
1718
  onUpdate?: string | undefined;
1678
1719
  onDelete?: string | undefined;
@@ -1681,6 +1722,7 @@ export declare const pgSchemaInternal: import("zod").ZodObject<{
1681
1722
  columnsFrom: string[];
1682
1723
  tableTo: string;
1683
1724
  columnsTo: string[];
1725
+ schemaTo: string;
1684
1726
  }>>;
1685
1727
  compositePrimaryKeys: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
1686
1728
  name: import("zod").ZodString;
@@ -1730,6 +1772,7 @@ export declare const pgSchemaInternal: import("zod").ZodObject<{
1730
1772
  columnsFrom: string[];
1731
1773
  tableTo: string;
1732
1774
  columnsTo: string[];
1775
+ schemaTo: string;
1733
1776
  }>;
1734
1777
  schema: string;
1735
1778
  compositePrimaryKeys: Record<string, {
@@ -1771,6 +1814,7 @@ export declare const pgSchemaInternal: import("zod").ZodObject<{
1771
1814
  columnsFrom: string[];
1772
1815
  tableTo: string;
1773
1816
  columnsTo: string[];
1817
+ schemaTo: string;
1774
1818
  }>;
1775
1819
  schema: string;
1776
1820
  compositePrimaryKeys: Record<string, {
@@ -1884,6 +1928,7 @@ export declare const pgSchemaInternal: import("zod").ZodObject<{
1884
1928
  columnsFrom: string[];
1885
1929
  tableTo: string;
1886
1930
  columnsTo: string[];
1931
+ schemaTo: string;
1887
1932
  }>;
1888
1933
  schema: string;
1889
1934
  compositePrimaryKeys: Record<string, {
@@ -1948,6 +1993,7 @@ export declare const pgSchemaInternal: import("zod").ZodObject<{
1948
1993
  columnsFrom: string[];
1949
1994
  tableTo: string;
1950
1995
  columnsTo: string[];
1996
+ schemaTo: string;
1951
1997
  }>;
1952
1998
  schema: string;
1953
1999
  compositePrimaryKeys: Record<string, {
@@ -2281,6 +2327,7 @@ 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").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>;
@@ -2292,6 +2339,7 @@ export declare const pgSchemaV3: import("zod").ZodObject<import("zod").extendSha
2292
2339
  columnsFrom: string[];
2293
2340
  tableTo: string;
2294
2341
  columnsTo: string[];
2342
+ schemaTo: string;
2295
2343
  }, {
2296
2344
  onUpdate?: string | undefined;
2297
2345
  onDelete?: string | undefined;
@@ -2300,6 +2348,7 @@ export declare const pgSchemaV3: import("zod").ZodObject<import("zod").extendSha
2300
2348
  columnsFrom: string[];
2301
2349
  tableTo: string;
2302
2350
  columnsTo: string[];
2351
+ schemaTo: string;
2303
2352
  }>>;
2304
2353
  }, "strict", import("zod").ZodTypeAny, {
2305
2354
  name: string;
@@ -2326,6 +2375,7 @@ export declare const pgSchemaV3: import("zod").ZodObject<import("zod").extendSha
2326
2375
  columnsFrom: string[];
2327
2376
  tableTo: string;
2328
2377
  columnsTo: string[];
2378
+ schemaTo: string;
2329
2379
  }>;
2330
2380
  }, {
2331
2381
  name: string;
@@ -2352,6 +2402,7 @@ export declare const pgSchemaV3: import("zod").ZodObject<import("zod").extendSha
2352
2402
  columnsFrom: string[];
2353
2403
  tableTo: string;
2354
2404
  columnsTo: string[];
2405
+ schemaTo: string;
2355
2406
  }>;
2356
2407
  }>>;
2357
2408
  enums: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
@@ -2397,6 +2448,7 @@ export declare const pgSchemaV3: import("zod").ZodObject<import("zod").extendSha
2397
2448
  columnsFrom: string[];
2398
2449
  tableTo: string;
2399
2450
  columnsTo: string[];
2451
+ schemaTo: string;
2400
2452
  }>;
2401
2453
  }>;
2402
2454
  enums: Record<string, {
@@ -2433,6 +2485,7 @@ export declare const pgSchemaV3: import("zod").ZodObject<import("zod").extendSha
2433
2485
  columnsFrom: string[];
2434
2486
  tableTo: string;
2435
2487
  columnsTo: string[];
2488
+ schemaTo: string;
2436
2489
  }>;
2437
2490
  }>;
2438
2491
  enums: Record<string, {
@@ -2492,6 +2545,7 @@ 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").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>;
@@ -2503,6 +2557,7 @@ export declare const pgSchemaV4: import("zod").ZodObject<import("zod").extendSha
2503
2557
  columnsFrom: string[];
2504
2558
  tableTo: string;
2505
2559
  columnsTo: string[];
2560
+ schemaTo: string;
2506
2561
  }, {
2507
2562
  onUpdate?: string | undefined;
2508
2563
  onDelete?: string | undefined;
@@ -2511,6 +2566,7 @@ export declare const pgSchemaV4: import("zod").ZodObject<import("zod").extendSha
2511
2566
  columnsFrom: string[];
2512
2567
  tableTo: string;
2513
2568
  columnsTo: string[];
2569
+ schemaTo: string;
2514
2570
  }>>;
2515
2571
  }, "strict", import("zod").ZodTypeAny, {
2516
2572
  name: string;
@@ -2537,6 +2593,7 @@ export declare const pgSchemaV4: import("zod").ZodObject<import("zod").extendSha
2537
2593
  columnsFrom: string[];
2538
2594
  tableTo: string;
2539
2595
  columnsTo: string[];
2596
+ schemaTo: string;
2540
2597
  }>;
2541
2598
  schema: string;
2542
2599
  }, {
@@ -2564,6 +2621,7 @@ export declare const pgSchemaV4: import("zod").ZodObject<import("zod").extendSha
2564
2621
  columnsFrom: string[];
2565
2622
  tableTo: string;
2566
2623
  columnsTo: string[];
2624
+ schemaTo: string;
2567
2625
  }>;
2568
2626
  schema: string;
2569
2627
  }>>;
@@ -2611,6 +2669,7 @@ export declare const pgSchemaV4: import("zod").ZodObject<import("zod").extendSha
2611
2669
  columnsFrom: string[];
2612
2670
  tableTo: string;
2613
2671
  columnsTo: string[];
2672
+ schemaTo: string;
2614
2673
  }>;
2615
2674
  schema: string;
2616
2675
  }>;
@@ -2649,6 +2708,7 @@ export declare const pgSchemaV4: import("zod").ZodObject<import("zod").extendSha
2649
2708
  columnsFrom: string[];
2650
2709
  tableTo: string;
2651
2710
  columnsTo: string[];
2711
+ schemaTo: string;
2652
2712
  }>;
2653
2713
  schema: string;
2654
2714
  }>;
@@ -2710,6 +2770,7 @@ 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").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>;
@@ -2721,6 +2782,7 @@ export declare const pgSchema: import("zod").ZodObject<import("zod").extendShape
2721
2782
  columnsFrom: string[];
2722
2783
  tableTo: string;
2723
2784
  columnsTo: string[];
2785
+ schemaTo: string;
2724
2786
  }, {
2725
2787
  onUpdate?: string | undefined;
2726
2788
  onDelete?: string | undefined;
@@ -2729,6 +2791,7 @@ export declare const pgSchema: import("zod").ZodObject<import("zod").extendShape
2729
2791
  columnsFrom: string[];
2730
2792
  tableTo: string;
2731
2793
  columnsTo: string[];
2794
+ schemaTo: string;
2732
2795
  }>>;
2733
2796
  compositePrimaryKeys: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
2734
2797
  name: import("zod").ZodString;
@@ -2778,6 +2841,7 @@ export declare const pgSchema: import("zod").ZodObject<import("zod").extendShape
2778
2841
  columnsFrom: string[];
2779
2842
  tableTo: string;
2780
2843
  columnsTo: string[];
2844
+ schemaTo: string;
2781
2845
  }>;
2782
2846
  schema: string;
2783
2847
  compositePrimaryKeys: Record<string, {
@@ -2819,6 +2883,7 @@ export declare const pgSchema: import("zod").ZodObject<import("zod").extendShape
2819
2883
  columnsFrom: string[];
2820
2884
  tableTo: string;
2821
2885
  columnsTo: string[];
2886
+ schemaTo: string;
2822
2887
  }>;
2823
2888
  schema: string;
2824
2889
  compositePrimaryKeys: Record<string, {
@@ -2937,6 +3002,7 @@ export declare const pgSchema: import("zod").ZodObject<import("zod").extendShape
2937
3002
  columnsFrom: string[];
2938
3003
  tableTo: string;
2939
3004
  columnsTo: string[];
3005
+ schemaTo: string;
2940
3006
  }>;
2941
3007
  schema: string;
2942
3008
  compositePrimaryKeys: Record<string, {
@@ -3003,6 +3069,7 @@ export declare const pgSchema: import("zod").ZodObject<import("zod").extendShape
3003
3069
  columnsFrom: string[];
3004
3070
  tableTo: string;
3005
3071
  columnsTo: string[];
3072
+ schemaTo: string;
3006
3073
  }>;
3007
3074
  schema: string;
3008
3075
  compositePrimaryKeys: Record<string, {
@@ -3429,6 +3496,7 @@ 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").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>;
@@ -3440,6 +3508,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3440
3508
  columnsFrom: string[];
3441
3509
  tableTo: string;
3442
3510
  columnsTo: string[];
3511
+ schemaTo: string;
3443
3512
  }, {
3444
3513
  onUpdate?: string | undefined;
3445
3514
  onDelete?: string | undefined;
@@ -3448,6 +3517,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3448
3517
  columnsFrom: string[];
3449
3518
  tableTo: string;
3450
3519
  columnsTo: string[];
3520
+ schemaTo: string;
3451
3521
  }>>;
3452
3522
  }, "strict", import("zod").ZodTypeAny, {
3453
3523
  name: string;
@@ -3474,6 +3544,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3474
3544
  columnsFrom: string[];
3475
3545
  tableTo: string;
3476
3546
  columnsTo: string[];
3547
+ schemaTo: string;
3477
3548
  }>;
3478
3549
  }, {
3479
3550
  name: string;
@@ -3500,6 +3571,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3500
3571
  columnsFrom: string[];
3501
3572
  tableTo: string;
3502
3573
  columnsTo: string[];
3574
+ schemaTo: string;
3503
3575
  }>;
3504
3576
  }>>;
3505
3577
  enums: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
@@ -3545,6 +3617,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3545
3617
  columnsFrom: string[];
3546
3618
  tableTo: string;
3547
3619
  columnsTo: string[];
3620
+ schemaTo: string;
3548
3621
  }>;
3549
3622
  }>;
3550
3623
  enums: Record<string, {
@@ -3581,6 +3654,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3581
3654
  columnsFrom: string[];
3582
3655
  tableTo: string;
3583
3656
  columnsTo: string[];
3657
+ schemaTo: string;
3584
3658
  }>;
3585
3659
  }>;
3586
3660
  enums: Record<string, {
@@ -3639,6 +3713,7 @@ 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").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>;
@@ -3650,6 +3725,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3650
3725
  columnsFrom: string[];
3651
3726
  tableTo: string;
3652
3727
  columnsTo: string[];
3728
+ schemaTo: string;
3653
3729
  }, {
3654
3730
  onUpdate?: string | undefined;
3655
3731
  onDelete?: string | undefined;
@@ -3658,6 +3734,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3658
3734
  columnsFrom: string[];
3659
3735
  tableTo: string;
3660
3736
  columnsTo: string[];
3737
+ schemaTo: string;
3661
3738
  }>>;
3662
3739
  }, "strict", import("zod").ZodTypeAny, {
3663
3740
  name: string;
@@ -3684,6 +3761,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3684
3761
  columnsFrom: string[];
3685
3762
  tableTo: string;
3686
3763
  columnsTo: string[];
3764
+ schemaTo: string;
3687
3765
  }>;
3688
3766
  schema: string;
3689
3767
  }, {
@@ -3711,6 +3789,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3711
3789
  columnsFrom: string[];
3712
3790
  tableTo: string;
3713
3791
  columnsTo: string[];
3792
+ schemaTo: string;
3714
3793
  }>;
3715
3794
  schema: string;
3716
3795
  }>>;
@@ -3758,6 +3837,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3758
3837
  columnsFrom: string[];
3759
3838
  tableTo: string;
3760
3839
  columnsTo: string[];
3840
+ schemaTo: string;
3761
3841
  }>;
3762
3842
  schema: string;
3763
3843
  }>;
@@ -3796,6 +3876,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3796
3876
  columnsFrom: string[];
3797
3877
  tableTo: string;
3798
3878
  columnsTo: string[];
3879
+ schemaTo: string;
3799
3880
  }>;
3800
3881
  schema: string;
3801
3882
  }>;
@@ -3856,6 +3937,7 @@ 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").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>;
@@ -3867,6 +3949,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3867
3949
  columnsFrom: string[];
3868
3950
  tableTo: string;
3869
3951
  columnsTo: string[];
3952
+ schemaTo: string;
3870
3953
  }, {
3871
3954
  onUpdate?: string | undefined;
3872
3955
  onDelete?: string | undefined;
@@ -3875,6 +3958,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3875
3958
  columnsFrom: string[];
3876
3959
  tableTo: string;
3877
3960
  columnsTo: string[];
3961
+ schemaTo: string;
3878
3962
  }>>;
3879
3963
  compositePrimaryKeys: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
3880
3964
  name: import("zod").ZodString;
@@ -3924,6 +4008,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3924
4008
  columnsFrom: string[];
3925
4009
  tableTo: string;
3926
4010
  columnsTo: string[];
4011
+ schemaTo: string;
3927
4012
  }>;
3928
4013
  schema: string;
3929
4014
  compositePrimaryKeys: Record<string, {
@@ -3965,6 +4050,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
3965
4050
  columnsFrom: string[];
3966
4051
  tableTo: string;
3967
4052
  columnsTo: string[];
4053
+ schemaTo: string;
3968
4054
  }>;
3969
4055
  schema: string;
3970
4056
  compositePrimaryKeys: Record<string, {
@@ -4083,6 +4169,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
4083
4169
  columnsFrom: string[];
4084
4170
  tableTo: string;
4085
4171
  columnsTo: string[];
4172
+ schemaTo: string;
4086
4173
  }>;
4087
4174
  schema: string;
4088
4175
  compositePrimaryKeys: Record<string, {
@@ -4149,6 +4236,7 @@ export declare const backwardCompatiblePgSchema: import("zod").ZodUnion<[import(
4149
4236
  columnsFrom: string[];
4150
4237
  tableTo: string;
4151
4238
  columnsTo: string[];
4239
+ schemaTo: string;
4152
4240
  }>;
4153
4241
  schema: string;
4154
4242
  compositePrimaryKeys: Record<string, {
@@ -4218,6 +4306,7 @@ export declare const dryPg: {
4218
4306
  columnsFrom: string[];
4219
4307
  tableTo: string;
4220
4308
  columnsTo: string[];
4309
+ schemaTo: string;
4221
4310
  }>;
4222
4311
  schema: string;
4223
4312
  compositePrimaryKeys: Record<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
@@ -106,6 +106,7 @@ export declare const statementsForDiffs: (in1: any, in2: any) => Promise<{
106
106
  columnsFrom: string[];
107
107
  tableTo: string;
108
108
  columnsTo: string[];
109
+ schemaTo: string;
109
110
  }>;
110
111
  schema: string;
111
112
  compositePrimaryKeys: Record<string, {
@@ -168,6 +169,7 @@ export declare const statementsForDiffs: (in1: any, in2: any) => Promise<{
168
169
  columnsFrom: string[];
169
170
  tableTo: string;
170
171
  columnsTo: string[];
172
+ schemaTo: string;
171
173
  }>;
172
174
  schema: string;
173
175
  compositePrimaryKeys: Record<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(),
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,
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 = statement.schema ? `"${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";
@@ -17947,7 +17960,7 @@ var init_introspect_pg = __esm({
17947
17960
  const schemaStatements = Object.entries(schemas).map((it) => {
17948
17961
  return `export const ${it[1]} = pgSchema("${it[0]}");
17949
17962
  `;
17950
- }).join();
17963
+ }).join("");
17951
17964
  const tableStatements = Object.values(schema4.tables).map((table4) => {
17952
17965
  const tableSchema = schemas[table4.schema];
17953
17966
  const func = tableSchema ? `${tableSchema}.table` : "pgTable";