rake-db 2.25.10 → 2.25.12
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 +10 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -4992,7 +4992,7 @@ const astEncoders = {
|
|
|
4992
4992
|
for (const key in ast.shape) {
|
|
4993
4993
|
if (timestamps.hasAnyTimestamps && (key === "createdAt" || key === "updatedAt"))
|
|
4994
4994
|
continue;
|
|
4995
|
-
const line = [`${quoteObjectKey(key)}: `];
|
|
4995
|
+
const line = [`${quoteObjectKey(key, config.snakeCase)}: `];
|
|
4996
4996
|
const columnCode = ast.shape[key].toCode(toCodeCtx, key);
|
|
4997
4997
|
for (const part of columnCode) {
|
|
4998
4998
|
addCode(line, part);
|
|
@@ -5055,7 +5055,7 @@ const astEncoders = {
|
|
|
5055
5055
|
const line = [
|
|
5056
5056
|
recreate ? `...t.${change.type}(t.name(${singleQuote(
|
|
5057
5057
|
change.item.data.name ?? key
|
|
5058
|
-
)})` : `${quoteObjectKey(key)}: t.${change.type}(`
|
|
5058
|
+
)})` : `${quoteObjectKey(key, config.snakeCase)}: t.${change.type}(`
|
|
5059
5059
|
];
|
|
5060
5060
|
const columnCode = change.item.toCode(toCodeCtx, key);
|
|
5061
5061
|
for (let i = 0; i < columnCode.length; i++) {
|
|
@@ -5068,7 +5068,7 @@ const astEncoders = {
|
|
|
5068
5068
|
} else if (change.type === "change") {
|
|
5069
5069
|
if (!change.from.column || !change.to.column) continue;
|
|
5070
5070
|
const line = [
|
|
5071
|
-
`${quoteObjectKey(key)}: t${change.name ? `.name(${singleQuote(change.name)})` : ""}.change(`
|
|
5071
|
+
`${quoteObjectKey(key, config.snakeCase)}: t${change.name ? `.name(${singleQuote(change.name)})` : ""}.change(`
|
|
5072
5072
|
];
|
|
5073
5073
|
const fromCode = change.from.column.toCode(
|
|
5074
5074
|
{
|
|
@@ -5104,7 +5104,9 @@ const astEncoders = {
|
|
|
5104
5104
|
code.push(line);
|
|
5105
5105
|
} else if (change.type === "rename") {
|
|
5106
5106
|
code.push([
|
|
5107
|
-
`${quoteObjectKey(key)}: t.rename(${singleQuote(
|
|
5107
|
+
`${quoteObjectKey(key, config.snakeCase)}: t.rename(${singleQuote(
|
|
5108
|
+
change.name
|
|
5109
|
+
)}),`
|
|
5108
5110
|
]);
|
|
5109
5111
|
} else {
|
|
5110
5112
|
exhaustive(change.type);
|
|
@@ -5201,10 +5203,12 @@ const astEncoders = {
|
|
|
5201
5203
|
ast
|
|
5202
5204
|
)}, [${ast.values.map(singleQuote).join(", ")}]);`;
|
|
5203
5205
|
},
|
|
5204
|
-
renameEnumValues(ast) {
|
|
5206
|
+
renameEnumValues(ast, config) {
|
|
5205
5207
|
return `await db.renameEnumValues(${quoteSchemaTable(
|
|
5206
5208
|
ast
|
|
5207
|
-
)}, { ${Object.entries(ast.values).map(
|
|
5209
|
+
)}, { ${Object.entries(ast.values).map(
|
|
5210
|
+
([from, to]) => `${quoteObjectKey(from, config.snakeCase)}: ${singleQuote(to)}`
|
|
5211
|
+
).join(", ")} });`;
|
|
5208
5212
|
},
|
|
5209
5213
|
changeEnumValues(ast) {
|
|
5210
5214
|
return `await db.changeEnumValues(${quoteSchemaTable(
|