rake-db 2.29.7 → 2.29.9

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.mjs CHANGED
@@ -406,7 +406,7 @@ const columnToSql = (config, name, item, values, hasMultiplePrimaryKeys, snakeCa
406
406
  const encodeColumnDefault = (def, values, column) => {
407
407
  if (def !== void 0 && def !== null && typeof def !== "function") {
408
408
  if (isRawSQL(def)) {
409
- return def.toSQL({ values });
409
+ return `(${def.toSQL({ values })})`;
410
410
  } else {
411
411
  return escapeForMigration(
412
412
  column instanceof ArrayColumn && Array.isArray(def) ? "{" + (column.data.item.data.encode ? def.map((x) => column.data.item.data.encode(x)) : def).join(",") + "}" : column?.data.encode ? column.data.encode(def) : def
@@ -3243,16 +3243,16 @@ const saveMigratedVersion = async (db, version, name, config) => {
3243
3243
  [version, name]
3244
3244
  );
3245
3245
  };
3246
- const createMigrationsSchemaAndTable = async (adapter, config) => {
3246
+ const createMigrationsSchemaAndTable = async (db, config) => {
3247
3247
  const { schema, table } = getMigrationsSchemaAndTable(config);
3248
3248
  if (schema) {
3249
- const res2 = await createSchema$1(adapter, schema);
3249
+ const res2 = await createSchema$1(db, schema);
3250
3250
  if (res2 === "done") {
3251
3251
  config.logger?.log(`Created schema "${schema}"`);
3252
3252
  }
3253
3253
  }
3254
3254
  const res = await createTable$1(
3255
- adapter,
3255
+ db,
3256
3256
  `${schema ? `"${schema}"."${table}"` : `"${table}"`} (version TEXT NOT NULL, name TEXT NOT NULL)`
3257
3257
  );
3258
3258
  if (res === "done") {
@@ -6074,5 +6074,5 @@ for (const key in rakeDbAliases) {
6074
6074
  if (command) rakeDbCommands[key] = rakeDbCommands[command];
6075
6075
  }
6076
6076
 
6077
- export { RakeDbError, astToMigration, concatSchemaAndName, createDatabase, createMigrationInterface, createSchema$1 as createSchema, createTable$1 as createTable, dbColumnToAst, dropDatabase, dropSchema, dropTable, encodeColumnDefault, getConstraintName, getDbStructureTableData, getDbTableColumnsChecks, getExcludeName, getIndexName, getMigrationsSchemaAndTable, getSchemaAndTableFromName, incrementIntermediateCaller, instantiateDbColumn, introspectDbSchema, makeDomainsMap, makeFileVersion, makeRakeDbConfig, makeStructureToAstCtx, migrate, migrateAndClose, migrationConfigDefaults, promptSelect, rakeDbCliWithAdapter, rakeDbCommands, redo, rollback, runMigration, saveMigratedVersion, setRakeDbCliRunFn, structureToAst, tableToAst, writeMigrationFile };
6077
+ export { RakeDbError, astToMigration, concatSchemaAndName, createDatabase, createMigrationInterface, createMigrationsSchemaAndTable, createSchema$1 as createSchema, createTable$1 as createTable, dbColumnToAst, dropDatabase, dropSchema, dropTable, encodeColumnDefault, getConstraintName, getDbStructureTableData, getDbTableColumnsChecks, getExcludeName, getIndexName, getMigrationsSchemaAndTable, getSchemaAndTableFromName, incrementIntermediateCaller, instantiateDbColumn, introspectDbSchema, makeDomainsMap, makeFileVersion, makeRakeDbConfig, makeStructureToAstCtx, migrate, migrateAndClose, migrationConfigDefaults, promptSelect, rakeDbCliWithAdapter, rakeDbCommands, redo, rollback, runMigration, saveMigratedVersion, setRakeDbCliRunFn, structureToAst, tableToAst, writeMigrationFile };
6078
6078
  //# sourceMappingURL=index.mjs.map