rake-db 2.20.14 → 2.20.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -495,7 +495,9 @@ const makeAst$2 = (up, tableName, shape, tableData, options, noPrimaryKey) => {
495
495
  name: table,
496
496
  shape
497
497
  }, tableData), {
498
- primaryKey: shapePKeys.length <= 1 ? primaryKey : primaryKey ? __spreadProps$6(__spreadValues$8({}, primaryKey), { columns: [...shapePKeys, ...primaryKey.columns] }) : { columns: shapePKeys }
498
+ primaryKey: shapePKeys.length <= 1 ? primaryKey : primaryKey ? __spreadProps$6(__spreadValues$8({}, primaryKey), {
499
+ columns: [.../* @__PURE__ */ new Set([...shapePKeys, ...primaryKey.columns])]
500
+ }) : { columns: shapePKeys }
499
501
  }), options), {
500
502
  noPrimaryKey: options.noPrimaryKey ? "ignore" : noPrimaryKey || "error"
501
503
  });
@@ -960,6 +962,7 @@ const astToQueries = (ast, snakeCase, language) => {
960
962
  );
961
963
  alterTable.unshift(...prependAlterTable);
962
964
  if (ast.add.primaryKey || addPrimaryKeys.change || addPrimaryKeys.columns.length > 1) {
965
+ addPrimaryKeys.columns = [...new Set(addPrimaryKeys.columns)];
963
966
  alterTable.push(
964
967
  `ADD ${primaryKeyToSql(
965
968
  snakeCase ? {
@@ -3216,7 +3219,7 @@ const processRakeDbConfig = (config) => {
3216
3219
  const ct = "columnTypes" in config && config.columnTypes;
3217
3220
  result.columnTypes = (typeof ct === "function" ? ct(
3218
3221
  pqb.makeColumnTypes(pqb.defaultSchemaConfig)
3219
- ) : ct) || pqb.makeColumnTypes;
3222
+ ) : ct) || pqb.makeColumnTypes(pqb.defaultSchemaConfig);
3220
3223
  }
3221
3224
  if (config.migrationId === "serial") {
3222
3225
  result.migrationId = { serial: 4 };