rake-db 2.29.9 → 2.30.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 +14 -13
- package/dist/index.js +172 -135
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +172 -135
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as pqb from 'pqb';
|
|
2
|
-
import { TableData, ColumnsShape, NoPrimaryKeyOption, MaybeArray, Column, RawSqlBase, RecordString, EnumColumn, EmptyObject, AdapterBase, DbResult, DefaultColumnTypes, DefaultSchemaConfig, QueryLogObject, TableDataFn, TableDataItem, DbDomainArg, ColumnSchemaConfig, raw, Db, MaybePromise, QueryLogOptions,
|
|
2
|
+
import { TableData, ColumnsShape, NoPrimaryKeyOption, MaybeArray, Column, RawSqlBase, RecordString, EnumColumn, EmptyObject, AdapterBase, DbResult, DefaultColumnTypes, DefaultSchemaConfig, QueryLogObject, TableDataFn, TableDataItem, DbDomainArg, ColumnSchemaConfig, raw, Db, QuerySchema, MaybePromise, QueryLogOptions, QueryLogger, SearchWeight, ColumnsByType, DbStructureDomainsMap } from 'pqb';
|
|
3
3
|
|
|
4
4
|
type RakeDbAst = RakeDbAst.Table | RakeDbAst.ChangeTable | RakeDbAst.RenameType | RakeDbAst.Schema | RakeDbAst.RenameSchema | RakeDbAst.Extension | RakeDbAst.Enum | RakeDbAst.EnumValues | RakeDbAst.RenameEnumValues | RakeDbAst.ChangeEnumValues | RakeDbAst.Domain | RakeDbAst.Collation | RakeDbAst.Constraint | RakeDbAst.RenameTableItem | RakeDbAst.View;
|
|
5
5
|
declare namespace RakeDbAst {
|
|
@@ -291,10 +291,10 @@ type ChangeTableOptions = {
|
|
|
291
291
|
comment?: string | [string, string] | null;
|
|
292
292
|
};
|
|
293
293
|
type ChangeTableCallback<CT> = (t: TableChanger<CT>) => TableChangeData;
|
|
294
|
-
|
|
294
|
+
interface SilentQueries extends AdapterBase {
|
|
295
295
|
silentQuery: AdapterBase['query'];
|
|
296
296
|
silentArrays: AdapterBase['arrays'];
|
|
297
|
-
}
|
|
297
|
+
}
|
|
298
298
|
type DbMigration<CT> = DbResult<CT> & Migration<CT> & {
|
|
299
299
|
adapter: SilentQueries;
|
|
300
300
|
};
|
|
@@ -1224,7 +1224,7 @@ interface CreateTableResult<Table extends string, Shape extends ColumnsShape> {
|
|
|
1224
1224
|
interface RakeDbCtx {
|
|
1225
1225
|
migrationsPromise?: Promise<MigrationsSet>;
|
|
1226
1226
|
}
|
|
1227
|
-
declare const getSchemaAndTableFromName: (
|
|
1227
|
+
declare const getSchemaAndTableFromName: (schema: QuerySchema | undefined, name: string) => [string | undefined, string];
|
|
1228
1228
|
declare const concatSchemaAndName: ({ schema, name, }: {
|
|
1229
1229
|
schema?: string;
|
|
1230
1230
|
name: string;
|
|
@@ -1248,6 +1248,7 @@ interface MigrationsSet {
|
|
|
1248
1248
|
migrations: MigrationItem[];
|
|
1249
1249
|
}
|
|
1250
1250
|
|
|
1251
|
+
type SearchPath = (() => string) | string;
|
|
1251
1252
|
interface RakeDbCliConfigInputBase<SchemaConfig extends ColumnSchemaConfig, CT = DefaultColumnTypes<DefaultSchemaConfig>> extends QueryLogOptions {
|
|
1252
1253
|
columnTypes?: CT | ((t: DefaultColumnTypes<DefaultSchemaConfig>) => CT);
|
|
1253
1254
|
baseTable?: RakeDbBaseTable<CT>;
|
|
@@ -1263,6 +1264,12 @@ interface RakeDbCliConfigInputBase<SchemaConfig extends ColumnSchemaConfig, CT =
|
|
|
1263
1264
|
[commandName: string]: RakeDbCommandFn | RakeDbCommand;
|
|
1264
1265
|
};
|
|
1265
1266
|
noPrimaryKey?: NoPrimaryKeyOption;
|
|
1267
|
+
transactionSearchPath?: SearchPath;
|
|
1268
|
+
/**
|
|
1269
|
+
* Throw if a migration doesn't have a default export.
|
|
1270
|
+
* This is needed when in your setup you're importing migration files first and execute them later,
|
|
1271
|
+
* in that case you should export changes in migrations.
|
|
1272
|
+
*/
|
|
1266
1273
|
forceDefaultExports?: boolean;
|
|
1267
1274
|
/**
|
|
1268
1275
|
* Is called once per db before migrating or rolling back a set of migrations.
|
|
@@ -1347,11 +1354,6 @@ interface RakeDbConfig<ColumnTypes = unknown> extends QueryLogOptions {
|
|
|
1347
1354
|
*/
|
|
1348
1355
|
__rakeDbConfig: true;
|
|
1349
1356
|
migrationsTable: string;
|
|
1350
|
-
/**
|
|
1351
|
-
* by default, all the migrated tables and the special table for tracking migrations are created in `public`.
|
|
1352
|
-
* set this `schema` setting to use create everything in this schema instead.
|
|
1353
|
-
*/
|
|
1354
|
-
schema?: QuerySchema;
|
|
1355
1357
|
recurrentPath?: string;
|
|
1356
1358
|
columnTypes: ColumnTypes;
|
|
1357
1359
|
beforeChange?: ChangeCallback$1;
|
|
@@ -1361,6 +1363,7 @@ interface RakeDbConfig<ColumnTypes = unknown> extends QueryLogOptions {
|
|
|
1361
1363
|
beforeRollback?: MigrationCallback;
|
|
1362
1364
|
afterRollback?: MigrationCallback;
|
|
1363
1365
|
migrationId: RakeDbMigrationId;
|
|
1366
|
+
transactionSearchPath?: SearchPath;
|
|
1364
1367
|
forceDefaultExports?: boolean;
|
|
1365
1368
|
afterChangeCommit?: ChangeCommitCallback;
|
|
1366
1369
|
basePath: string;
|
|
@@ -1496,8 +1499,7 @@ interface GetIndexOrExcludeName {
|
|
|
1496
1499
|
}
|
|
1497
1500
|
declare const getIndexName: GetIndexOrExcludeName;
|
|
1498
1501
|
declare const getExcludeName: GetIndexOrExcludeName;
|
|
1499
|
-
declare const getMigrationsSchemaAndTable: (config: {
|
|
1500
|
-
schema?: QuerySchema;
|
|
1502
|
+
declare const getMigrationsSchemaAndTable: (adapter: AdapterBase, config: {
|
|
1501
1503
|
migrationsTable: string;
|
|
1502
1504
|
}) => {
|
|
1503
1505
|
schema?: string;
|
|
@@ -1518,7 +1520,6 @@ type DbParam = OrmParam | AdapterBase;
|
|
|
1518
1520
|
|
|
1519
1521
|
declare const saveMigratedVersion: (db: SilentQueries, version: string, name: string, config: Pick<RakeDbConfig, 'migrationsTable'>) => Promise<void>;
|
|
1520
1522
|
declare const createMigrationsSchemaAndTable: (db: DbParam, config: {
|
|
1521
|
-
schema?: QuerySchema;
|
|
1522
1523
|
migrationsTable: string;
|
|
1523
1524
|
logger?: QueryLogger;
|
|
1524
1525
|
}) => Promise<void>;
|
|
@@ -1736,7 +1737,7 @@ interface StructureToAstTableData {
|
|
|
1736
1737
|
constraints: DbStructure.Constraint[];
|
|
1737
1738
|
}
|
|
1738
1739
|
declare const makeStructureToAstCtx: (config: Pick<RakeDbConfig, 'snakeCase' | 'schemaConfig'>, currentSchema: string) => StructureToAstCtx;
|
|
1739
|
-
declare const structureToAst: (ctx: StructureToAstCtx, adapter: AdapterBase, config: Pick<RakeDbConfig, '
|
|
1740
|
+
declare const structureToAst: (ctx: StructureToAstCtx, adapter: AdapterBase, config: Pick<RakeDbConfig, 'migrationsTable'>) => Promise<RakeDbAst[]>;
|
|
1740
1741
|
declare const makeDomainsMap: (ctx: StructureToAstCtx, data: IntrospectedStructure) => DbStructureDomainsMap;
|
|
1741
1742
|
declare const instantiateDbColumn: (ctx: StructureToAstCtx, data: IntrospectedStructure, domains: DbStructureDomainsMap, dbColumn: DbStructure.Column) => Column<pqb.ColumnTypeSchemaArg, unknown, any, any, unknown, unknown, any, unknown, any>;
|
|
1742
1743
|
declare const tableToAst: (ctx: StructureToAstCtx, data: IntrospectedStructure, table: DbStructure.Table, action: 'create' | 'drop', domains: DbStructureDomainsMap) => RakeDbAst.Table;
|