rake-db 2.31.1 → 2.32.1
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 +6 -1
- package/dist/index.js +9 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as pqb_internal from 'pqb/internal';
|
|
2
|
-
import { SearchWeight, RecordOptionalString, DefaultPrivileges, AdapterBase, TableData, ColumnsShape, NoPrimaryKeyOption, MaybeArray, Column, RawSqlBase, RecordString, EmptyObject, EnumColumn, DbResult, QueryLogObject, ColumnSchemaConfig, raw, TableDataFn, TableDataItem, DbDomainArg, DefaultColumnTypes, DefaultSchemaConfig,
|
|
2
|
+
import { SearchWeight, RecordOptionalString, DefaultPrivileges, AdapterBase, TableData, ColumnsShape, NoPrimaryKeyOption, MaybeArray, Column, RawSqlBase, RecordString, EmptyObject, EnumColumn, DbResult, QueryLogObject, ColumnSchemaConfig, raw, TableDataFn, TableDataItem, DbDomainArg, DefaultColumnTypes, DefaultSchemaConfig, QueryLogger, QueryLogOptions, MaybePromise, ColumnsByType, DbStructureDomainsMap } from 'pqb/internal';
|
|
3
|
+
import { Db, QuerySchema } from 'pqb';
|
|
3
4
|
|
|
4
5
|
declare namespace DbStructure {
|
|
5
6
|
interface TableNameAndSchemaName {
|
|
@@ -1555,6 +1556,10 @@ interface MigrateConfigBase extends QueryLogOptions {
|
|
|
1555
1556
|
afterMigrate?: MigrationCallback;
|
|
1556
1557
|
beforeRollback?: MigrationCallback;
|
|
1557
1558
|
afterRollback?: MigrationCallback;
|
|
1559
|
+
snakeCase?: boolean;
|
|
1560
|
+
language?: string;
|
|
1561
|
+
noPrimaryKey?: NoPrimaryKeyOption;
|
|
1562
|
+
baseTable?: RakeDbBaseTable<unknown>;
|
|
1558
1563
|
}
|
|
1559
1564
|
interface MigrateConfigFileBased extends MigrateConfigBase {
|
|
1560
1565
|
basePath?: string;
|
package/dist/index.js
CHANGED
|
@@ -1390,7 +1390,7 @@ const pushIndexesOrExcludes = (key, from, to, name, add2, drop2) => {
|
|
|
1390
1390
|
};
|
|
1391
1391
|
const getChangeColumnName = (what, change, key, snakeCase) => {
|
|
1392
1392
|
return change.name || (change[what].column ? (
|
|
1393
|
-
//
|
|
1393
|
+
//
|
|
1394
1394
|
getColumnName(change[what].column, key, snakeCase)
|
|
1395
1395
|
) : snakeCase ? internal.toSnakeCase(key) : key);
|
|
1396
1396
|
};
|
|
@@ -3530,12 +3530,18 @@ const processMigrateConfig = (config) => {
|
|
|
3530
3530
|
migrationsPath = path$1.resolve(config.basePath, migrationsPath);
|
|
3531
3531
|
}
|
|
3532
3532
|
}
|
|
3533
|
-
|
|
3533
|
+
const result = {
|
|
3534
3534
|
...migrateConfigDefaults,
|
|
3535
3535
|
...config,
|
|
3536
3536
|
migrationsPath,
|
|
3537
3537
|
logger: handleConfigLogger(config)
|
|
3538
3538
|
};
|
|
3539
|
+
if ("baseTable" in config && config.baseTable) {
|
|
3540
|
+
const { snakeCase, language } = config.baseTable.prototype;
|
|
3541
|
+
if (snakeCase) result.snakeCase = true;
|
|
3542
|
+
if (language) result.language = language;
|
|
3543
|
+
}
|
|
3544
|
+
return result;
|
|
3539
3545
|
};
|
|
3540
3546
|
const transactionIfSingle = (adapter, config, fn) => {
|
|
3541
3547
|
return config.transaction === "single" ? transaction(adapter, config, fn) : fn(adapter);
|
|
@@ -6561,10 +6567,8 @@ const makeRakeDbConfig = (config, args) => {
|
|
|
6561
6567
|
result.recurrentPath = path.resolve(result.basePath, result.recurrentPath);
|
|
6562
6568
|
}
|
|
6563
6569
|
if ("baseTable" in config && config.baseTable) {
|
|
6564
|
-
const { types
|
|
6570
|
+
const { types } = config.baseTable.prototype;
|
|
6565
6571
|
result.columnTypes = types || internal.makeColumnTypes(internal.defaultSchemaConfig);
|
|
6566
|
-
if (snakeCase) result.snakeCase = true;
|
|
6567
|
-
if (language) result.language = language;
|
|
6568
6572
|
} else {
|
|
6569
6573
|
const ct = "columnTypes" in config && config.columnTypes;
|
|
6570
6574
|
result.columnTypes = (typeof ct === "function" ? ct(
|