rake-db 2.4.32 → 2.4.34
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 +11 -5
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ColumnType, EnumColumn, ColumnTypes, ColumnsShape, DbResult, DefaultColumnTypes, TransactionAdapter, QueryLogObject, IndexColumnOptions, IndexOptions, ForeignKeyOptions, TextColumn, NoPrimaryKeyOption, TableData, SingleColumnIndexOptions, AdapterOptions, QueryLogOptions
|
|
1
|
+
import { ColumnType, EnumColumn, ColumnTypes, ColumnsShape, Adapter, DbResult, DefaultColumnTypes, TransactionAdapter, QueryLogObject, IndexColumnOptions, IndexOptions, ForeignKeyOptions, TextColumn, NoPrimaryKeyOption, TableData, SingleColumnIndexOptions, AdapterOptions, QueryLogOptions } from 'pqb';
|
|
2
2
|
import { EmptyObject, RawExpression, ColumnTypesBase, raw, MaybeArray } from 'orchid-core';
|
|
3
3
|
|
|
4
4
|
declare function add(this: ColumnTypesBase, item: ColumnType, options?: {
|
|
@@ -54,7 +54,13 @@ declare type ColumnComment = {
|
|
|
54
54
|
column: string;
|
|
55
55
|
comment: string | null;
|
|
56
56
|
};
|
|
57
|
-
declare type
|
|
57
|
+
declare type SilentQueries = {
|
|
58
|
+
silentQuery: Adapter['query'];
|
|
59
|
+
silentArrays: Adapter['arrays'];
|
|
60
|
+
};
|
|
61
|
+
declare type Migration = DbResult<DefaultColumnTypes> & MigrationBase & {
|
|
62
|
+
adapter: SilentQueries;
|
|
63
|
+
};
|
|
58
64
|
declare type ConstraintArg = {
|
|
59
65
|
name?: string;
|
|
60
66
|
references?: [
|
|
@@ -264,8 +270,8 @@ declare const redo: (options: MaybeArray<AdapterOptions>, config: RakeDbConfig,
|
|
|
264
270
|
|
|
265
271
|
declare const rakeDb: (options: MaybeArray<AdapterOptions>, partialConfig?: Partial<RakeDbConfig>, args?: string[]) => Promise<void>;
|
|
266
272
|
|
|
267
|
-
declare const saveMigratedVersion: (db:
|
|
268
|
-
declare const removeMigratedVersion: (db:
|
|
273
|
+
declare const saveMigratedVersion: (db: SilentQueries, version: string, config: RakeDbConfig) => Promise<void>;
|
|
274
|
+
declare const removeMigratedVersion: (db: SilentQueries, version: string, config: RakeDbConfig) => Promise<void>;
|
|
269
275
|
declare const getMigratedVersionsMap: (db: Adapter, config: RakeDbConfig) => Promise<Record<string, boolean>>;
|
|
270
276
|
|
|
271
|
-
export { AppCodeUpdater, ChangeTableCallback, ChangeTableOptions, ColumnComment, ColumnsShapeCallback, DropMode, Migration, MigrationBase, MigrationColumnTypes, RakeDbAst, RakeDbConfig, TableOptions, change, changeCache, createDb, createMigrationInterface, dropDb, generate, getMigratedVersionsMap, makeFileTimeStamp, migrate, migrateOrRollback, rakeDb, redo, removeMigratedVersion, resetDb, rollback, saveMigratedVersion, writeMigrationFile };
|
|
277
|
+
export { AppCodeUpdater, ChangeTableCallback, ChangeTableOptions, ColumnComment, ColumnsShapeCallback, DropMode, Migration, MigrationBase, MigrationColumnTypes, RakeDbAst, RakeDbConfig, SilentQueries, TableOptions, change, changeCache, createDb, createMigrationInterface, dropDb, generate, getMigratedVersionsMap, makeFileTimeStamp, migrate, migrateOrRollback, rakeDb, redo, removeMigratedVersion, resetDb, rollback, saveMigratedVersion, writeMigrationFile };
|
package/dist/index.js
CHANGED
|
@@ -1197,6 +1197,7 @@ const createMigrationInterface = (tx, up, options) => {
|
|
|
1197
1197
|
adapter.arrays = (q, types) => {
|
|
1198
1198
|
return wrapWithLog(log, q, () => arrays.call(adapter, q, types));
|
|
1199
1199
|
};
|
|
1200
|
+
Object.assign(adapter, { silentQuery: query, silentArrays: arrays });
|
|
1200
1201
|
const db = pqb.createDb({ adapter });
|
|
1201
1202
|
const { prototype: proto } = MigrationBase;
|
|
1202
1203
|
for (const key of Object.getOwnPropertyNames(proto)) {
|
|
@@ -1460,14 +1461,14 @@ const queryExists = (db, sql) => {
|
|
|
1460
1461
|
};
|
|
1461
1462
|
|
|
1462
1463
|
const saveMigratedVersion = async (db, version, config) => {
|
|
1463
|
-
await db.
|
|
1464
|
+
await db.silentArrays(
|
|
1464
1465
|
`INSERT INTO ${quoteWithSchema({
|
|
1465
1466
|
name: config.migrationsTable
|
|
1466
1467
|
})} VALUES ('${version}')`
|
|
1467
1468
|
);
|
|
1468
1469
|
};
|
|
1469
1470
|
const removeMigratedVersion = async (db, version, config) => {
|
|
1470
|
-
await db.
|
|
1471
|
+
await db.silentArrays(
|
|
1471
1472
|
`DELETE FROM ${quoteWithSchema({
|
|
1472
1473
|
name: config.migrationsTable
|
|
1473
1474
|
})} WHERE version = '${version}'`
|