drizzle-kit 0.20.17-b2e8c7f → 0.20.17-c057923

Sign up to get free protection for your applications and to get access to all the features.
package/bin.cjs CHANGED
@@ -8661,7 +8661,7 @@ var init_cli = __esm({
8661
8661
  dialect: dialect3,
8662
8662
  schema: unionType([stringType(), stringType().array()]).optional(),
8663
8663
  tablesFilter: unionType([stringType(), stringType().array()]).optional(),
8664
- schemaFilter: unionType([stringType(), stringType().array()]).optional().default(["public"]),
8664
+ schemaFilters: unionType([stringType(), stringType().array()]).optional().default(["public"]),
8665
8665
  driver: stringType().optional(),
8666
8666
  // pg
8667
8667
  connectionString: stringType().optional(),
@@ -14475,7 +14475,7 @@ var init_utils4 = __esm({
14475
14475
  }
14476
14476
  const tablesFilterConfig = config.tablesFilter;
14477
14477
  const tablesFilter = tablesFilterConfig ? typeof tablesFilterConfig === "string" ? [tablesFilterConfig] : tablesFilterConfig : [];
14478
- const schemasFilterConfig = config.schemaFilter;
14478
+ const schemasFilterConfig = config.schemaFilters;
14479
14479
  const schemasFilter = schemasFilterConfig ? typeof schemasFilterConfig === "string" ? [schemasFilterConfig] : schemasFilterConfig : [];
14480
14480
  if (dialect7 === "postgresql") {
14481
14481
  const parsed = postgresCredentials.safeParse(config);
@@ -19673,7 +19673,7 @@ var init_snapshotsDiffer = __esm({
19673
19673
  const jsonTableAlternations = alteredTables.map((it) => {
19674
19674
  return preparePgAlterColumns(it.name, it.schema, it.altered, json2);
19675
19675
  }).flat();
19676
- const jsonCreateIndexesFoAlteredTables = alteredTables.map((it) => {
19676
+ const jsonCreateIndexesForAllAlteredTables = alteredTables.map((it) => {
19677
19677
  return prepareCreateIndexesJson(
19678
19678
  it.name,
19679
19679
  it.schema,
@@ -19702,21 +19702,14 @@ var init_snapshotsDiffer = __esm({
19702
19702
  },
19703
19703
  {}
19704
19704
  );
19705
- jsonCreateIndexesFoAlteredTables.push(
19705
+ jsonCreateIndexesForAllAlteredTables.push(
19706
19706
  ...prepareCreateIndexesJson(it.name, it.schema, createdIndexes || {})
19707
19707
  );
19708
19708
  jsonDropIndexesForAllAlteredTables.push(
19709
19709
  ...prepareDropIndexesJson(it.name, it.schema, droppedIndexes || {})
19710
19710
  );
19711
19711
  });
19712
- const jsonCreateReferencesForCreatedTables = createdTables.map((it) => {
19713
- return prepareCreateReferencesJson(
19714
- it.name,
19715
- it.schema,
19716
- it.foreignKeys
19717
- );
19718
- }).flat();
19719
- const jsonReferencesForAlteredTables = alteredTables.map((it) => {
19712
+ const jsonReferencesForAllAlteredTables = alteredTables.map((it) => {
19720
19713
  const forAdded = prepareCreateReferencesJson(
19721
19714
  it.name,
19722
19715
  it.schema,
@@ -19734,10 +19727,10 @@ var init_snapshotsDiffer = __esm({
19734
19727
  );
19735
19728
  return [...forAdded, ...forAltered, ...alteredFKs];
19736
19729
  }).flat();
19737
- const jsonCreatedReferencesForAlteredTables = jsonReferencesForAlteredTables.filter(
19730
+ const jsonCreatedReferencesForAlteredTables = jsonReferencesForAllAlteredTables.filter(
19738
19731
  (t) => t.type === "create_reference"
19739
19732
  );
19740
- const jsonDroppedReferencesForAlteredTables = jsonReferencesForAlteredTables.filter(
19733
+ const jsonDroppedReferencesForAlteredTables = jsonReferencesForAllAlteredTables.filter(
19741
19734
  (t) => t.type === "delete_reference"
19742
19735
  );
19743
19736
  const createEnums = createdEnums.map((it) => {
@@ -19764,7 +19757,7 @@ var init_snapshotsDiffer = __esm({
19764
19757
  const dropSchemas = prepareDeleteSchemasJson(
19765
19758
  deletedSchemas.map((it) => it.name)
19766
19759
  );
19767
- const createTables = createdTables.map((it) => {
19760
+ const jsonPgCreateTables = createdTables.map((it) => {
19768
19761
  return preparePgCreateTableJson(it, curFull);
19769
19762
  });
19770
19763
  jsonStatements.push(...createSchemas);
@@ -19773,7 +19766,7 @@ var init_snapshotsDiffer = __esm({
19773
19766
  jsonStatements.push(...moveEnums);
19774
19767
  jsonStatements.push(...renameEnums);
19775
19768
  jsonStatements.push(...jsonAlterEnumsWithAddedValues);
19776
- jsonStatements.push(...createTables);
19769
+ jsonStatements.push(...jsonPgCreateTables);
19777
19770
  jsonStatements.push(...jsonDropTables);
19778
19771
  jsonStatements.push(...jsonSetTableSchemas);
19779
19772
  jsonStatements.push(...jsonRenameTables);
@@ -19784,10 +19777,9 @@ var init_snapshotsDiffer = __esm({
19784
19777
  jsonStatements.push(...jsonTableAlternations);
19785
19778
  jsonStatements.push(...jsonAddedCompositePKs);
19786
19779
  jsonStatements.push(...jsonAddColumnsStatemets);
19787
- jsonStatements.push(...jsonCreateReferencesForCreatedTables);
19788
19780
  jsonStatements.push(...jsonCreateIndexesForCreatedTables);
19781
+ jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
19789
19782
  jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
19790
- jsonStatements.push(...jsonCreateIndexesFoAlteredTables);
19791
19783
  jsonStatements.push(...jsonDropColumnsStatemets);
19792
19784
  jsonStatements.push(...jsonAlteredCompositePKs);
19793
19785
  jsonStatements.push(...jsonAlteredUniqueConstraints);
@@ -20046,13 +20038,6 @@ var init_snapshotsDiffer = __esm({
20046
20038
  ...prepareDropIndexesJson(it.name, it.schema, droppedIndexes || {})
20047
20039
  );
20048
20040
  });
20049
- const jsonCreateReferencesForCreatedTables = createdTables.map((it) => {
20050
- return prepareCreateReferencesJson(
20051
- it.name,
20052
- it.schema,
20053
- it.foreignKeys
20054
- );
20055
- }).flat();
20056
20041
  const jsonReferencesForAllAlteredTables = alteredTables.map((it) => {
20057
20042
  const forAdded = prepareCreateReferencesJson(
20058
20043
  it.name,
@@ -20093,10 +20078,9 @@ var init_snapshotsDiffer = __esm({
20093
20078
  jsonStatements.push(...jsonAddedUniqueConstraints);
20094
20079
  jsonStatements.push(...jsonDeletedUniqueConstraints);
20095
20080
  jsonStatements.push(...jsonAddColumnsStatemets);
20096
- jsonStatements.push(...jsonCreateReferencesForCreatedTables);
20097
20081
  jsonStatements.push(...jsonCreateIndexesForCreatedTables);
20098
- jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
20099
20082
  jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
20083
+ jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
20100
20084
  jsonStatements.push(...jsonDropColumnsStatemets);
20101
20085
  jsonStatements.push(...jsonAlteredCompositePKs);
20102
20086
  jsonStatements.push(...jsonAddedUniqueConstraints);
@@ -99867,7 +99851,7 @@ var init_connections = __esm({
99867
99851
  );
99868
99852
  console.log(
99869
99853
  withStyle.fullWarning(
99870
- "'@neondatabase/serverless' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket"
99854
+ "'@neondatabase/serverless' connects through a websocket only to remote Neon instance"
99871
99855
  )
99872
99856
  );
99873
99857
  const { Client: Client2 } = await Promise.resolve().then(() => (init_serverless(), serverless_exports));
@@ -99894,7 +99878,7 @@ var init_connections = __esm({
99894
99878
  );
99895
99879
  console.log(
99896
99880
  withStyle.fullWarning(
99897
- "'@vercel/postgres' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket"
99881
+ "'@vercel/postgres' connects through a websocket only to remote Vercel Postgres instance"
99898
99882
  )
99899
99883
  );
99900
99884
  const { Client: Client2 } = await Promise.resolve().then(() => (init_index_node(), index_node_exports));
@@ -103749,7 +103733,7 @@ import { sql } from "drizzle-orm"
103749
103733
  });
103750
103734
 
103751
103735
  // src/introspect-pg.ts
103752
- var import_drizzle_orm9, import_relations, pgImportsList, objToStatement23, timeConfig2, possibleIntervals, intervalStrToObj, intervalConfig, importsPatch2, relations3, withCasing2, paramNameFor, schemaToTypeScript3, isCyclic3, isSelf3, column6, dimensionsInArray, createTableColumns3, createTableIndexes3, createTablePKs3, createTableUniques3, createTableFKs3;
103736
+ var import_drizzle_orm9, import_relations, pgImportsList, objToStatement23, timeConfig2, possibleIntervals, intervalStrToObj, intervalConfig, importsPatch2, relations3, withCasing2, schemaToTypeScript3, isCyclic3, isSelf3, column6, dimensionsInArray, createTableColumns3, createTableIndexes3, createTablePKs3, createTableUniques3, createTableFKs3;
103753
103737
  var init_introspect_pg = __esm({
103754
103738
  "src/introspect-pg.ts"() {
103755
103739
  "use strict";
@@ -103874,10 +103858,6 @@ var init_introspect_pg = __esm({
103874
103858
  }
103875
103859
  assertUnreachable(casing2);
103876
103860
  };
103877
- paramNameFor = (name, schema5) => {
103878
- const schemaSuffix = schema5 && schema5 !== "public" ? `In${schema5}` : "";
103879
- return `${name}${schemaSuffix}`;
103880
- };
103881
103861
  schemaToTypeScript3 = (schema5, casing2) => {
103882
103862
  Object.values(schema5.tables).forEach((table4) => {
103883
103863
  Object.values(table4.foreignKeys).forEach((fk4) => {
@@ -103934,7 +103914,7 @@ var init_introspect_pg = __esm({
103934
103914
  );
103935
103915
  const enumStatements = Object.values(schema5.enums).map((it) => {
103936
103916
  const enumSchema3 = schemas[it.schema];
103937
- const paramName = paramNameFor(it.name, enumSchema3);
103917
+ const paramName = !enumSchema3 || enumSchema3 === "public" ? it.name : `${it.name}In${enumSchema3}`;
103938
103918
  const func = enumSchema3 ? `${enumSchema3}.enum` : "pgEnum";
103939
103919
  const values2 = Object.values(it.values).map((it2) => `'${it2}'`).join(", ");
103940
103920
  return `export const ${withCasing2(paramName, casing2)} = ${func}("${it.name}", [${values2}])
@@ -103946,7 +103926,7 @@ var init_introspect_pg = __esm({
103946
103926
  }).join("");
103947
103927
  const tableStatements = Object.values(schema5.tables).map((table4) => {
103948
103928
  const tableSchema = schemas[table4.schema];
103949
- const paramName = paramNameFor(table4.name, tableSchema);
103929
+ const paramName = !tableSchema || tableSchema === "public" ? table4.name : `${table4.name}In${tableSchema}`;
103950
103930
  const func = tableSchema ? `${tableSchema}.table` : "pgTable";
103951
103931
  let statement = `export const ${withCasing2(paramName, casing2)} = ${func}("${table4.name}", {
103952
103932
  `;
@@ -103955,7 +103935,6 @@ var init_introspect_pg = __esm({
103955
103935
  Object.values(table4.columns),
103956
103936
  Object.values(table4.foreignKeys),
103957
103937
  enumTypes,
103958
- schemas,
103959
103938
  casing2,
103960
103939
  schema5.internal
103961
103940
  );
@@ -103972,7 +103951,7 @@ var init_introspect_pg = __esm({
103972
103951
  Object.values(table4.indexes),
103973
103952
  casing2
103974
103953
  );
103975
- statement += createTableFKs3(Object.values(filteredFKs), schemas, casing2);
103954
+ statement += createTableFKs3(Object.values(filteredFKs), casing2);
103976
103955
  statement += createTablePKs3(
103977
103956
  Object.values(table4.compositePrimaryKeys),
103978
103957
  casing2
@@ -103994,8 +103973,8 @@ var init_introspect_pg = __esm({
103994
103973
  import { sql } from "drizzle-orm"
103995
103974
 
103996
103975
  `;
103997
- let decalrations = schemaStatements;
103998
- decalrations += enumStatements;
103976
+ let decalrations = enumStatements;
103977
+ decalrations += schemaStatements;
103999
103978
  decalrations += "\n";
104000
103979
  decalrations += tableStatements.join("\n\n");
104001
103980
  const file = importsTs + decalrations;
@@ -104222,7 +104201,7 @@ var init_introspect_pg = __esm({
104222
104201
  }
104223
104202
  return res;
104224
104203
  };
104225
- createTableColumns3 = (tableName, columns, fks, enumTypes, schemas, casing2, internals) => {
104204
+ createTableColumns3 = (tableName, columns, fks, enumTypes, casing2, internals) => {
104226
104205
  let statement = "";
104227
104206
  const oneColumnsFKs = Object.values(fks).filter((it) => {
104228
104207
  return !isSelf3(it);
@@ -104261,16 +104240,14 @@ var init_introspect_pg = __esm({
104261
104240
  const params = { onDelete, onUpdate };
104262
104241
  const typeSuffix = isCyclic3(it2) ? ": AnyPgColumn" : "";
104263
104242
  const paramsStr = objToStatement23(params);
104264
- const tableSchema = schemas[it2.schemaTo || ""];
104265
- const paramName = paramNameFor(it2.tableTo, tableSchema);
104266
104243
  if (paramsStr) {
104267
104244
  return `.references(()${typeSuffix} => ${withCasing2(
104268
- paramName,
104245
+ it2.tableTo,
104269
104246
  casing2
104270
104247
  )}.${withCasing2(it2.columnsTo[0], casing2)}, ${paramsStr} )`;
104271
104248
  }
104272
104249
  return `.references(()${typeSuffix} => ${withCasing2(
104273
- paramName,
104250
+ it2.tableTo,
104274
104251
  casing2
104275
104252
  )}.${withCasing2(it2.columnsTo[0], casing2)})`;
104276
104253
  }).join("");
@@ -104326,13 +104303,11 @@ var init_introspect_pg = __esm({
104326
104303
  });
104327
104304
  return statement;
104328
104305
  };
104329
- createTableFKs3 = (fks, schemas, casing2) => {
104306
+ createTableFKs3 = (fks, casing2) => {
104330
104307
  let statement = "";
104331
104308
  fks.forEach((it) => {
104332
- const tableSchema = schemas[it.schemaTo || ""];
104333
- const paramName = paramNameFor(it.tableTo, tableSchema);
104334
104309
  const isSelf4 = it.tableTo === it.tableFrom;
104335
- const tableTo = isSelf4 ? "table" : `${withCasing2(paramName, casing2)}`;
104310
+ const tableTo = isSelf4 ? "table" : `${withCasing2(it.tableTo, casing2)}`;
104336
104311
  statement += ` ${withCasing2(it.name, casing2)}: foreignKey({
104337
104312
  `;
104338
104313
  statement += ` columns: [${it.columnsFrom.map((i) => `table.${withCasing2(i, casing2)}`).join(", ")}],
@@ -106642,8 +106617,8 @@ Drizzle Studio is up and running on ${source_default.blue(
106642
106617
  });
106643
106618
  } catch (e) {
106644
106619
  console.error(e);
106645
- process.exit(0);
106646
106620
  }
106621
+ process.exit(0);
106647
106622
  });
106648
106623
  var main = async () => {
106649
106624
  const version2 = await versions();
@@ -29,7 +29,7 @@ export declare const pushParams: import("zod").ZodObject<{
29
29
  dialect: import("zod").ZodEnum<["postgresql", "mysql", "sqlite"]>;
30
30
  schema: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
31
31
  tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
32
- schemaFilter: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>>;
32
+ schemaFilters: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>>;
33
33
  driver: import("zod").ZodOptional<import("zod").ZodString>;
34
34
  connectionString: import("zod").ZodOptional<import("zod").ZodString>;
35
35
  uri: import("zod").ZodOptional<import("zod").ZodString>;
@@ -60,7 +60,7 @@ export declare const pushParams: import("zod").ZodObject<{
60
60
  tablesFilter?: string | string[] | undefined;
61
61
  verbose?: boolean | undefined;
62
62
  dialect: "mysql" | "postgresql" | "sqlite";
63
- schemaFilter: string | string[];
63
+ schemaFilters: string | string[];
64
64
  }, {
65
65
  strict?: boolean | undefined;
66
66
  schema?: string | string[] | undefined;
@@ -76,8 +76,8 @@ export declare const pushParams: import("zod").ZodObject<{
76
76
  ssl?: string | undefined;
77
77
  authToken?: string | undefined;
78
78
  tablesFilter?: string | string[] | undefined;
79
- schemaFilter?: string | string[] | undefined;
80
79
  verbose?: boolean | undefined;
80
+ schemaFilters?: string | string[] | undefined;
81
81
  dialect: "mysql" | "postgresql" | "sqlite";
82
82
  }>;
83
83
  export type PushParams = TypeOf<typeof pushParams>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.20.17-b2e8c7f",
3
+ "version": "0.20.17-c057923",
4
4
  "repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
5
5
  "author": "Drizzle Team",
6
6
  "license": "MIT",
package/payload.js CHANGED
@@ -5511,7 +5511,7 @@ var init_cli = __esm({
5511
5511
  dialect: dialect3,
5512
5512
  schema: unionType([stringType(), stringType().array()]).optional(),
5513
5513
  tablesFilter: unionType([stringType(), stringType().array()]).optional(),
5514
- schemaFilter: unionType([stringType(), stringType().array()]).optional().default(["public"]),
5514
+ schemaFilters: unionType([stringType(), stringType().array()]).optional().default(["public"]),
5515
5515
  driver: stringType().optional(),
5516
5516
  // pg
5517
5517
  connectionString: stringType().optional(),
@@ -15088,7 +15088,7 @@ var init_snapshotsDiffer = __esm({
15088
15088
  const jsonTableAlternations = alteredTables.map((it) => {
15089
15089
  return preparePgAlterColumns(it.name, it.schema, it.altered, json2);
15090
15090
  }).flat();
15091
- const jsonCreateIndexesFoAlteredTables = alteredTables.map((it) => {
15091
+ const jsonCreateIndexesForAllAlteredTables = alteredTables.map((it) => {
15092
15092
  return prepareCreateIndexesJson(
15093
15093
  it.name,
15094
15094
  it.schema,
@@ -15117,21 +15117,14 @@ var init_snapshotsDiffer = __esm({
15117
15117
  },
15118
15118
  {}
15119
15119
  );
15120
- jsonCreateIndexesFoAlteredTables.push(
15120
+ jsonCreateIndexesForAllAlteredTables.push(
15121
15121
  ...prepareCreateIndexesJson(it.name, it.schema, createdIndexes || {})
15122
15122
  );
15123
15123
  jsonDropIndexesForAllAlteredTables.push(
15124
15124
  ...prepareDropIndexesJson(it.name, it.schema, droppedIndexes || {})
15125
15125
  );
15126
15126
  });
15127
- const jsonCreateReferencesForCreatedTables = createdTables.map((it) => {
15128
- return prepareCreateReferencesJson(
15129
- it.name,
15130
- it.schema,
15131
- it.foreignKeys
15132
- );
15133
- }).flat();
15134
- const jsonReferencesForAlteredTables = alteredTables.map((it) => {
15127
+ const jsonReferencesForAllAlteredTables = alteredTables.map((it) => {
15135
15128
  const forAdded = prepareCreateReferencesJson(
15136
15129
  it.name,
15137
15130
  it.schema,
@@ -15149,10 +15142,10 @@ var init_snapshotsDiffer = __esm({
15149
15142
  );
15150
15143
  return [...forAdded, ...forAltered, ...alteredFKs];
15151
15144
  }).flat();
15152
- const jsonCreatedReferencesForAlteredTables = jsonReferencesForAlteredTables.filter(
15145
+ const jsonCreatedReferencesForAlteredTables = jsonReferencesForAllAlteredTables.filter(
15153
15146
  (t) => t.type === "create_reference"
15154
15147
  );
15155
- const jsonDroppedReferencesForAlteredTables = jsonReferencesForAlteredTables.filter(
15148
+ const jsonDroppedReferencesForAlteredTables = jsonReferencesForAllAlteredTables.filter(
15156
15149
  (t) => t.type === "delete_reference"
15157
15150
  );
15158
15151
  const createEnums = createdEnums.map((it) => {
@@ -15179,7 +15172,7 @@ var init_snapshotsDiffer = __esm({
15179
15172
  const dropSchemas = prepareDeleteSchemasJson(
15180
15173
  deletedSchemas.map((it) => it.name)
15181
15174
  );
15182
- const createTables = createdTables.map((it) => {
15175
+ const jsonPgCreateTables = createdTables.map((it) => {
15183
15176
  return preparePgCreateTableJson(it, curFull);
15184
15177
  });
15185
15178
  jsonStatements.push(...createSchemas);
@@ -15188,7 +15181,7 @@ var init_snapshotsDiffer = __esm({
15188
15181
  jsonStatements.push(...moveEnums);
15189
15182
  jsonStatements.push(...renameEnums);
15190
15183
  jsonStatements.push(...jsonAlterEnumsWithAddedValues);
15191
- jsonStatements.push(...createTables);
15184
+ jsonStatements.push(...jsonPgCreateTables);
15192
15185
  jsonStatements.push(...jsonDropTables);
15193
15186
  jsonStatements.push(...jsonSetTableSchemas);
15194
15187
  jsonStatements.push(...jsonRenameTables);
@@ -15199,10 +15192,9 @@ var init_snapshotsDiffer = __esm({
15199
15192
  jsonStatements.push(...jsonTableAlternations);
15200
15193
  jsonStatements.push(...jsonAddedCompositePKs);
15201
15194
  jsonStatements.push(...jsonAddColumnsStatemets);
15202
- jsonStatements.push(...jsonCreateReferencesForCreatedTables);
15203
15195
  jsonStatements.push(...jsonCreateIndexesForCreatedTables);
15196
+ jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
15204
15197
  jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
15205
- jsonStatements.push(...jsonCreateIndexesFoAlteredTables);
15206
15198
  jsonStatements.push(...jsonDropColumnsStatemets);
15207
15199
  jsonStatements.push(...jsonAlteredCompositePKs);
15208
15200
  jsonStatements.push(...jsonAlteredUniqueConstraints);
@@ -15461,13 +15453,6 @@ var init_snapshotsDiffer = __esm({
15461
15453
  ...prepareDropIndexesJson(it.name, it.schema, droppedIndexes || {})
15462
15454
  );
15463
15455
  });
15464
- const jsonCreateReferencesForCreatedTables = createdTables.map((it) => {
15465
- return prepareCreateReferencesJson(
15466
- it.name,
15467
- it.schema,
15468
- it.foreignKeys
15469
- );
15470
- }).flat();
15471
15456
  const jsonReferencesForAllAlteredTables = alteredTables.map((it) => {
15472
15457
  const forAdded = prepareCreateReferencesJson(
15473
15458
  it.name,
@@ -15508,10 +15493,9 @@ var init_snapshotsDiffer = __esm({
15508
15493
  jsonStatements.push(...jsonAddedUniqueConstraints);
15509
15494
  jsonStatements.push(...jsonDeletedUniqueConstraints);
15510
15495
  jsonStatements.push(...jsonAddColumnsStatemets);
15511
- jsonStatements.push(...jsonCreateReferencesForCreatedTables);
15512
15496
  jsonStatements.push(...jsonCreateIndexesForCreatedTables);
15513
- jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
15514
15497
  jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
15498
+ jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
15515
15499
  jsonStatements.push(...jsonDropColumnsStatemets);
15516
15500
  jsonStatements.push(...jsonAlteredCompositePKs);
15517
15501
  jsonStatements.push(...jsonAddedUniqueConstraints);
package/payload.mjs CHANGED
@@ -5517,7 +5517,7 @@ var init_cli = __esm({
5517
5517
  dialect: dialect3,
5518
5518
  schema: unionType([stringType(), stringType().array()]).optional(),
5519
5519
  tablesFilter: unionType([stringType(), stringType().array()]).optional(),
5520
- schemaFilter: unionType([stringType(), stringType().array()]).optional().default(["public"]),
5520
+ schemaFilters: unionType([stringType(), stringType().array()]).optional().default(["public"]),
5521
5521
  driver: stringType().optional(),
5522
5522
  // pg
5523
5523
  connectionString: stringType().optional(),
@@ -15102,7 +15102,7 @@ var init_snapshotsDiffer = __esm({
15102
15102
  const jsonTableAlternations = alteredTables.map((it) => {
15103
15103
  return preparePgAlterColumns(it.name, it.schema, it.altered, json2);
15104
15104
  }).flat();
15105
- const jsonCreateIndexesFoAlteredTables = alteredTables.map((it) => {
15105
+ const jsonCreateIndexesForAllAlteredTables = alteredTables.map((it) => {
15106
15106
  return prepareCreateIndexesJson(
15107
15107
  it.name,
15108
15108
  it.schema,
@@ -15131,21 +15131,14 @@ var init_snapshotsDiffer = __esm({
15131
15131
  },
15132
15132
  {}
15133
15133
  );
15134
- jsonCreateIndexesFoAlteredTables.push(
15134
+ jsonCreateIndexesForAllAlteredTables.push(
15135
15135
  ...prepareCreateIndexesJson(it.name, it.schema, createdIndexes || {})
15136
15136
  );
15137
15137
  jsonDropIndexesForAllAlteredTables.push(
15138
15138
  ...prepareDropIndexesJson(it.name, it.schema, droppedIndexes || {})
15139
15139
  );
15140
15140
  });
15141
- const jsonCreateReferencesForCreatedTables = createdTables.map((it) => {
15142
- return prepareCreateReferencesJson(
15143
- it.name,
15144
- it.schema,
15145
- it.foreignKeys
15146
- );
15147
- }).flat();
15148
- const jsonReferencesForAlteredTables = alteredTables.map((it) => {
15141
+ const jsonReferencesForAllAlteredTables = alteredTables.map((it) => {
15149
15142
  const forAdded = prepareCreateReferencesJson(
15150
15143
  it.name,
15151
15144
  it.schema,
@@ -15163,10 +15156,10 @@ var init_snapshotsDiffer = __esm({
15163
15156
  );
15164
15157
  return [...forAdded, ...forAltered, ...alteredFKs];
15165
15158
  }).flat();
15166
- const jsonCreatedReferencesForAlteredTables = jsonReferencesForAlteredTables.filter(
15159
+ const jsonCreatedReferencesForAlteredTables = jsonReferencesForAllAlteredTables.filter(
15167
15160
  (t) => t.type === "create_reference"
15168
15161
  );
15169
- const jsonDroppedReferencesForAlteredTables = jsonReferencesForAlteredTables.filter(
15162
+ const jsonDroppedReferencesForAlteredTables = jsonReferencesForAllAlteredTables.filter(
15170
15163
  (t) => t.type === "delete_reference"
15171
15164
  );
15172
15165
  const createEnums = createdEnums.map((it) => {
@@ -15193,7 +15186,7 @@ var init_snapshotsDiffer = __esm({
15193
15186
  const dropSchemas = prepareDeleteSchemasJson(
15194
15187
  deletedSchemas.map((it) => it.name)
15195
15188
  );
15196
- const createTables = createdTables.map((it) => {
15189
+ const jsonPgCreateTables = createdTables.map((it) => {
15197
15190
  return preparePgCreateTableJson(it, curFull);
15198
15191
  });
15199
15192
  jsonStatements.push(...createSchemas);
@@ -15202,7 +15195,7 @@ var init_snapshotsDiffer = __esm({
15202
15195
  jsonStatements.push(...moveEnums);
15203
15196
  jsonStatements.push(...renameEnums);
15204
15197
  jsonStatements.push(...jsonAlterEnumsWithAddedValues);
15205
- jsonStatements.push(...createTables);
15198
+ jsonStatements.push(...jsonPgCreateTables);
15206
15199
  jsonStatements.push(...jsonDropTables);
15207
15200
  jsonStatements.push(...jsonSetTableSchemas);
15208
15201
  jsonStatements.push(...jsonRenameTables);
@@ -15213,10 +15206,9 @@ var init_snapshotsDiffer = __esm({
15213
15206
  jsonStatements.push(...jsonTableAlternations);
15214
15207
  jsonStatements.push(...jsonAddedCompositePKs);
15215
15208
  jsonStatements.push(...jsonAddColumnsStatemets);
15216
- jsonStatements.push(...jsonCreateReferencesForCreatedTables);
15217
15209
  jsonStatements.push(...jsonCreateIndexesForCreatedTables);
15210
+ jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
15218
15211
  jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
15219
- jsonStatements.push(...jsonCreateIndexesFoAlteredTables);
15220
15212
  jsonStatements.push(...jsonDropColumnsStatemets);
15221
15213
  jsonStatements.push(...jsonAlteredCompositePKs);
15222
15214
  jsonStatements.push(...jsonAlteredUniqueConstraints);
@@ -15475,13 +15467,6 @@ var init_snapshotsDiffer = __esm({
15475
15467
  ...prepareDropIndexesJson(it.name, it.schema, droppedIndexes || {})
15476
15468
  );
15477
15469
  });
15478
- const jsonCreateReferencesForCreatedTables = createdTables.map((it) => {
15479
- return prepareCreateReferencesJson(
15480
- it.name,
15481
- it.schema,
15482
- it.foreignKeys
15483
- );
15484
- }).flat();
15485
15470
  const jsonReferencesForAllAlteredTables = alteredTables.map((it) => {
15486
15471
  const forAdded = prepareCreateReferencesJson(
15487
15472
  it.name,
@@ -15522,10 +15507,9 @@ var init_snapshotsDiffer = __esm({
15522
15507
  jsonStatements.push(...jsonAddedUniqueConstraints);
15523
15508
  jsonStatements.push(...jsonDeletedUniqueConstraints);
15524
15509
  jsonStatements.push(...jsonAddColumnsStatemets);
15525
- jsonStatements.push(...jsonCreateReferencesForCreatedTables);
15526
15510
  jsonStatements.push(...jsonCreateIndexesForCreatedTables);
15527
- jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
15528
15511
  jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
15512
+ jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
15529
15513
  jsonStatements.push(...jsonDropColumnsStatemets);
15530
15514
  jsonStatements.push(...jsonAlteredCompositePKs);
15531
15515
  jsonStatements.push(...jsonAddedUniqueConstraints);