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 +4 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -360,7 +360,7 @@ const columnToSql = (name, item, values, hasMultiplePrimaryKeys, snakeCase) => {
|
|
|
360
360
|
line.push(checkToSql(item.data.check, values));
|
|
361
361
|
}
|
|
362
362
|
const def = item.data.default;
|
|
363
|
-
if (def !== void 0 && def !== null) {
|
|
363
|
+
if (def !== void 0 && def !== null && typeof def !== "function") {
|
|
364
364
|
if (isRawSQL(def)) {
|
|
365
365
|
line.push(`DEFAULT ${def.toSQL({ values })}`);
|
|
366
366
|
} else {
|
|
@@ -1123,11 +1123,11 @@ const astToQueries = (ast, snakeCase, language) => {
|
|
|
1123
1123
|
);
|
|
1124
1124
|
}
|
|
1125
1125
|
if (from.default !== to.default) {
|
|
1126
|
-
const value = to.default === void 0
|
|
1127
|
-
if (changeType && value !==
|
|
1126
|
+
const value = to.default === void 0 || to.default === null || typeof to.default === "function" ? null : typeof to.default === "object" && isRawSQL(to.default) ? to.default.toSQL({ values }) : quote(to.default);
|
|
1127
|
+
if (changeType && value !== null) {
|
|
1128
1128
|
alterTable.push(`ALTER COLUMN "${name}" DROP DEFAULT`);
|
|
1129
1129
|
}
|
|
1130
|
-
const expr = value ===
|
|
1130
|
+
const expr = value === null ? "DROP DEFAULT" : `SET DEFAULT ${value}`;
|
|
1131
1131
|
alterTable.push(`ALTER COLUMN "${name}" ${expr}`);
|
|
1132
1132
|
}
|
|
1133
1133
|
if (from.nullable !== to.nullable) {
|