rake-db 2.10.29 → 2.10.30

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
@@ -362,7 +362,7 @@ const columnToSql = (name, item, values, hasMultiplePrimaryKeys, snakeCase) => {
362
362
  line.push(checkToSql(item.data.check, values));
363
363
  }
364
364
  const def = item.data.default;
365
- if (def !== void 0 && def !== null) {
365
+ if (def !== void 0 && def !== null && typeof def !== "function") {
366
366
  if (orchidCore.isRawSQL(def)) {
367
367
  line.push(`DEFAULT ${def.toSQL({ values })}`);
368
368
  } else {
@@ -1125,11 +1125,11 @@ const astToQueries = (ast, snakeCase, language) => {
1125
1125
  );
1126
1126
  }
1127
1127
  if (from.default !== to.default) {
1128
- const value = to.default === void 0 ? void 0 : typeof to.default === "object" && to.default && orchidCore.isRawSQL(to.default) ? to.default.toSQL({ values }) : pqb.quote(to.default);
1129
- if (changeType && value !== void 0) {
1128
+ const value = to.default === void 0 || to.default === null || typeof to.default === "function" ? null : typeof to.default === "object" && orchidCore.isRawSQL(to.default) ? to.default.toSQL({ values }) : pqb.quote(to.default);
1129
+ if (changeType && value !== null) {
1130
1130
  alterTable.push(`ALTER COLUMN "${name}" DROP DEFAULT`);
1131
1131
  }
1132
- const expr = value === void 0 || value === null ? "DROP DEFAULT" : `SET DEFAULT ${value}`;
1132
+ const expr = value === null ? "DROP DEFAULT" : `SET DEFAULT ${value}`;
1133
1133
  alterTable.push(`ALTER COLUMN "${name}" ${expr}`);
1134
1134
  }
1135
1135
  if (from.nullable !== to.nullable) {