orchid-orm 1.69.1 → 1.69.3
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 +8 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -4
- package/dist/index.mjs.map +1 -1
- package/dist/migrations/index.js +13 -7
- package/dist/migrations/index.js.map +1 -1
- package/dist/migrations/index.mjs +13 -7
- package/dist/migrations/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -81,7 +81,6 @@ function createBaseTable({ schemaConfig = pqb_internal.defaultSchemaConfig, colu
|
|
|
81
81
|
throw new Error(`Failed to determine file path for table ${this.constructor.name}. Please set \`filePath\` property manually`);
|
|
82
82
|
}
|
|
83
83
|
setColumns(fn, dataFn) {
|
|
84
|
-
columnTypes[pqb_internal.snakeCaseKey] = this.snakeCase;
|
|
85
84
|
const shape = (0, pqb_internal.getColumnTypes)(columnTypes, fn, nowSQL, this.language);
|
|
86
85
|
const tableData = (0, pqb_internal.parseTableData)(dataFn);
|
|
87
86
|
if (this.snakeCase) for (const key in shape) {
|
|
@@ -1381,7 +1380,13 @@ const assignTablesToOrm = (tables, result, adapter, qb, asyncStorage, commonOpti
|
|
|
1381
1380
|
for (const key in tables) {
|
|
1382
1381
|
if (key[0] === "$") throw new Error(`Table class name must not start with $`);
|
|
1383
1382
|
const tableClass = tables[key];
|
|
1384
|
-
const
|
|
1383
|
+
const tableImmutable = tableClass.instance();
|
|
1384
|
+
const table = Object.create(tableImmutable);
|
|
1385
|
+
table.q = { ...table.q };
|
|
1386
|
+
table.columns = {
|
|
1387
|
+
shape: { ...table.columns.shape },
|
|
1388
|
+
data: { ...table.columns.data }
|
|
1389
|
+
};
|
|
1385
1390
|
tableInstances[key] = table;
|
|
1386
1391
|
const options = {
|
|
1387
1392
|
...commonOptions,
|
|
@@ -1395,7 +1400,7 @@ const assignTablesToOrm = (tables, result, adapter, qb, asyncStorage, commonOpti
|
|
|
1395
1400
|
computed: table.computed,
|
|
1396
1401
|
nowSQL: tableClass.nowSQL
|
|
1397
1402
|
};
|
|
1398
|
-
const dbTable = new pqb.Db(adapter, qb, table.table, table.columns.shape, table.types, asyncStorage, options, table.
|
|
1403
|
+
const dbTable = new pqb.Db(adapter, qb, table.table, table.columns.shape, table.types, asyncStorage, options, table.columns?.data ?? {});
|
|
1399
1404
|
dbTable.definedAs = key;
|
|
1400
1405
|
dbTable.db = result;
|
|
1401
1406
|
dbTable.filePath = table.filePath;
|