orchid-orm 1.50.4 → 1.51.0
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 +10 -22
- package/dist/index.js +18 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -15
- package/dist/index.mjs.map +1 -1
- package/dist/migrations.js +8 -6
- package/dist/migrations.js.map +1 -1
- package/dist/migrations.mjs +9 -7
- package/dist/migrations.mjs.map +1 -1
- package/package.json +5 -5
package/dist/migrations.js
CHANGED
|
@@ -2276,7 +2276,8 @@ const report = (ast, config, currentSchema) => {
|
|
|
2276
2276
|
}).join(", ")}` : ""}${indexes?.length ? indexes.length === 1 ? ", has index" : `, has ${indexes.length} indexes` : ""}${excludes?.length ? excludes.length === 1 ? ", has exclude" : `, has ${excludes.length} excludes` : ""}${checks?.length ? `, checks ${checks.map((check) => check.sql.toSQL({ values: [] })).join(", ")}` : ""}`
|
|
2277
2277
|
);
|
|
2278
2278
|
} else if (change.type === "change") {
|
|
2279
|
-
|
|
2279
|
+
let name = change.from.column?.data.name ?? key;
|
|
2280
|
+
if (config.snakeCase) name = orchidCore.toCamelCase(name);
|
|
2280
2281
|
const changes2 = [];
|
|
2281
2282
|
inner.push(`${yellow("~ change column")} ${name}:`, changes2);
|
|
2282
2283
|
changes2.push(`${yellow("from")}: `);
|
|
@@ -2291,7 +2292,7 @@ const report = (ast, config, currentSchema) => {
|
|
|
2291
2292
|
}
|
|
2292
2293
|
} else if (change.type === "rename") {
|
|
2293
2294
|
inner.push(
|
|
2294
|
-
`${yellow("~ rename column")} ${key} ${yellow("=>")} ${change.name}`
|
|
2295
|
+
`${yellow("~ rename column")} ${config.snakeCase ? orchidCore.toCamelCase(key) : key} ${yellow("=>")} ${change.name}`
|
|
2295
2296
|
);
|
|
2296
2297
|
} else {
|
|
2297
2298
|
rakeDb.exhaustive(change.type);
|
|
@@ -2514,7 +2515,7 @@ const generate = async (options, config, args, afterPull) => {
|
|
|
2514
2515
|
const [adapter] = adapters;
|
|
2515
2516
|
const currentSchema = adapter.schema ?? "public";
|
|
2516
2517
|
const db = await getDbFromConfig(config, dbPath);
|
|
2517
|
-
const { columnTypes, internal } = db.$
|
|
2518
|
+
const { columnTypes, internal } = db.$qb;
|
|
2518
2519
|
const codeItems = await getActualItems(
|
|
2519
2520
|
db,
|
|
2520
2521
|
currentSchema,
|
|
@@ -2599,7 +2600,7 @@ const getDbFromConfig = async (config, dbPath) => {
|
|
|
2599
2600
|
url.pathToFileURL(path.resolve(config.basePath, dbPath)).toString()
|
|
2600
2601
|
);
|
|
2601
2602
|
const db = module[config.dbExportedAs ?? "db"];
|
|
2602
|
-
if (!db?.$
|
|
2603
|
+
if (!db?.$qb) {
|
|
2603
2604
|
throw new Error(
|
|
2604
2605
|
`Unable to import OrchidORM instance as ${config.dbExportedAs ?? "db"} from ${config.dbPath}`
|
|
2605
2606
|
);
|
|
@@ -2944,7 +2945,7 @@ const appCodeGenUpdateDbFile = async (dbPath, tables, extensions, domains, curre
|
|
|
2944
2945
|
if (extensions.length) {
|
|
2945
2946
|
code += `
|
|
2946
2947
|
extensions: [${extensions.map(
|
|
2947
|
-
(ext) => ext.version ? `{ ${orchidCore.quoteObjectKey(ext.name)}: '${ext.version}' }` : orchidCore.singleQuote(ext.name)
|
|
2948
|
+
(ext) => ext.version ? `{ ${orchidCore.quoteObjectKey(ext.name, false)}: '${ext.version}' }` : orchidCore.singleQuote(ext.name)
|
|
2948
2949
|
).join(", ")}],`;
|
|
2949
2950
|
}
|
|
2950
2951
|
if (domains.length) {
|
|
@@ -2952,7 +2953,8 @@ const appCodeGenUpdateDbFile = async (dbPath, tables, extensions, domains, curre
|
|
|
2952
2953
|
domains: {
|
|
2953
2954
|
${domains.sort((a, b) => a.name > b.name ? 1 : -1).map(
|
|
2954
2955
|
(ast) => `${orchidCore.quoteObjectKey(
|
|
2955
|
-
ast.schema ? `${ast.schema}.${ast.name}` : ast.name
|
|
2956
|
+
ast.schema ? `${ast.schema}.${ast.name}` : ast.name,
|
|
2957
|
+
false
|
|
2956
2958
|
)}: (t) => ${ast.baseType.toCode(
|
|
2957
2959
|
{ t: "t", table: ast.name, currentSchema },
|
|
2958
2960
|
ast.baseType.data.name ?? ""
|