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 CHANGED
@@ -4994,7 +4994,7 @@ const astEncoders = {
4994
4994
  for (const key in ast.shape) {
4995
4995
  if (timestamps.hasAnyTimestamps && (key === "createdAt" || key === "updatedAt"))
4996
4996
  continue;
4997
- const line = [`${orchidCore.quoteObjectKey(key)}: `];
4997
+ const line = [`${orchidCore.quoteObjectKey(key, config.snakeCase)}: `];
4998
4998
  const columnCode = ast.shape[key].toCode(toCodeCtx, key);
4999
4999
  for (const part of columnCode) {
5000
5000
  orchidCore.addCode(line, part);
@@ -5057,7 +5057,7 @@ const astEncoders = {
5057
5057
  const line = [
5058
5058
  recreate ? `...t.${change.type}(t.name(${orchidCore.singleQuote(
5059
5059
  change.item.data.name ?? key
5060
- )})` : `${orchidCore.quoteObjectKey(key)}: t.${change.type}(`
5060
+ )})` : `${orchidCore.quoteObjectKey(key, config.snakeCase)}: t.${change.type}(`
5061
5061
  ];
5062
5062
  const columnCode = change.item.toCode(toCodeCtx, key);
5063
5063
  for (let i = 0; i < columnCode.length; i++) {
@@ -5070,7 +5070,7 @@ const astEncoders = {
5070
5070
  } else if (change.type === "change") {
5071
5071
  if (!change.from.column || !change.to.column) continue;
5072
5072
  const line = [
5073
- `${orchidCore.quoteObjectKey(key)}: t${change.name ? `.name(${orchidCore.singleQuote(change.name)})` : ""}.change(`
5073
+ `${orchidCore.quoteObjectKey(key, config.snakeCase)}: t${change.name ? `.name(${orchidCore.singleQuote(change.name)})` : ""}.change(`
5074
5074
  ];
5075
5075
  const fromCode = change.from.column.toCode(
5076
5076
  {
@@ -5106,7 +5106,9 @@ const astEncoders = {
5106
5106
  code.push(line);
5107
5107
  } else if (change.type === "rename") {
5108
5108
  code.push([
5109
- `${orchidCore.quoteObjectKey(key)}: t.rename(${orchidCore.singleQuote(change.name)}),`
5109
+ `${orchidCore.quoteObjectKey(key, config.snakeCase)}: t.rename(${orchidCore.singleQuote(
5110
+ change.name
5111
+ )}),`
5110
5112
  ]);
5111
5113
  } else {
5112
5114
  exhaustive(change.type);
@@ -5203,10 +5205,12 @@ const astEncoders = {
5203
5205
  ast
5204
5206
  )}, [${ast.values.map(orchidCore.singleQuote).join(", ")}]);`;
5205
5207
  },
5206
- renameEnumValues(ast) {
5208
+ renameEnumValues(ast, config) {
5207
5209
  return `await db.renameEnumValues(${quoteSchemaTable(
5208
5210
  ast
5209
- )}, { ${Object.entries(ast.values).map(([from, to]) => `${orchidCore.quoteObjectKey(from)}: ${orchidCore.singleQuote(to)}`).join(", ")} });`;
5211
+ )}, { ${Object.entries(ast.values).map(
5212
+ ([from, to]) => `${orchidCore.quoteObjectKey(from, config.snakeCase)}: ${orchidCore.singleQuote(to)}`
5213
+ ).join(", ")} });`;
5210
5214
  },
5211
5215
  changeEnumValues(ast) {
5212
5216
  return `await db.changeEnumValues(${quoteSchemaTable(