rake-db 2.3.26 → 2.3.27

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
@@ -1167,17 +1167,14 @@ const createEnum = async (migration, up, name, values, options = {}) => {
1167
1167
  name: enumName,
1168
1168
  values
1169
1169
  }, options);
1170
- let text;
1170
+ let query;
1171
1171
  const quotedName = quoteWithSchema(ast);
1172
1172
  if (ast.action === "create") {
1173
- text = `CREATE TYPE ${quotedName} AS ENUM (${values.map((_, i) => `$${i + 1}`).join(", ")})`;
1173
+ query = `CREATE TYPE ${quotedName} AS ENUM (${values.map(pqb.quote).join(", ")})`;
1174
1174
  } else {
1175
- text = `DROP TYPE${ast.dropIfExists ? " IF EXISTS" : ""} ${quotedName}${ast.cascade ? " CASCADE" : ""}`;
1175
+ query = `DROP TYPE${ast.dropIfExists ? " IF EXISTS" : ""} ${quotedName}${ast.cascade ? " CASCADE" : ""}`;
1176
1176
  }
1177
- await migration.adapter.query({
1178
- text,
1179
- values
1180
- });
1177
+ await migration.adapter.query(query);
1181
1178
  await runCodeUpdater(migration, ast);
1182
1179
  };
1183
1180
  const queryExists = (db, sql) => {