rake-db 2.10.27 → 2.10.29
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.d.ts +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -359,11 +359,12 @@ const columnToSql = (name, item, values, hasMultiplePrimaryKeys, snakeCase) => {
|
|
|
359
359
|
if (item.data.check) {
|
|
360
360
|
line.push(checkToSql(item.data.check, values));
|
|
361
361
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
362
|
+
const def = item.data.default;
|
|
363
|
+
if (def !== void 0 && def !== null) {
|
|
364
|
+
if (isRawSQL(def)) {
|
|
365
|
+
line.push(`DEFAULT ${def.toSQL({ values })}`);
|
|
365
366
|
} else {
|
|
366
|
-
line.push(`DEFAULT ${quote(
|
|
367
|
+
line.push(`DEFAULT ${quote(def)}`);
|
|
367
368
|
}
|
|
368
369
|
}
|
|
369
370
|
const { foreignKeys } = item.data;
|
|
@@ -1126,7 +1127,7 @@ const astToQueries = (ast, snakeCase, language) => {
|
|
|
1126
1127
|
if (changeType && value !== void 0) {
|
|
1127
1128
|
alterTable.push(`ALTER COLUMN "${name}" DROP DEFAULT`);
|
|
1128
1129
|
}
|
|
1129
|
-
const expr = value === void 0 ? "DROP DEFAULT" : `SET DEFAULT ${value}`;
|
|
1130
|
+
const expr = value === void 0 || value === null ? "DROP DEFAULT" : `SET DEFAULT ${value}`;
|
|
1130
1131
|
alterTable.push(`ALTER COLUMN "${name}" ${expr}`);
|
|
1131
1132
|
}
|
|
1132
1133
|
if (from.nullable !== to.nullable) {
|