@h3ravel/arquebus 0.3.6 → 0.4.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/bin/index.cjs +4365 -2840
- package/bin/index.js +4373 -2848
- package/dist/browser/index.cjs +2 -0
- package/dist/browser/index.d.cts +94 -7
- package/dist/browser/index.d.ts +94 -7
- package/dist/browser/index.js +2 -1
- package/dist/index.cjs +1499 -24
- package/dist/index.d.cts +129 -10
- package/dist/index.d.ts +129 -10
- package/dist/index.js +1500 -26
- package/dist/inspector/index.cjs +4885 -0
- package/dist/inspector/index.d.cts +83 -0
- package/dist/inspector/index.d.ts +83 -0
- package/dist/inspector/index.js +4859 -0
- package/dist/migrations/index.cjs +4386 -2912
- package/dist/migrations/index.d.cts +127 -9
- package/dist/migrations/index.d.ts +128 -10
- package/dist/migrations/index.js +4265 -2791
- package/package.json +27 -18
- package/types/query-builder.ts +37 -1
- package/src/migrations/stubs/migration-js.stub +0 -21
- package/src/migrations/stubs/migration-ts.stub +0 -18
- package/src/migrations/stubs/migration.create-js.stub +0 -24
- package/src/migrations/stubs/migration.create-ts.stub +0 -21
- package/src/migrations/stubs/migration.update-js.stub +0 -25
- package/src/migrations/stubs/migration.update-ts.stub +0 -22
- package/src/stubs/arquebus.config-js.stub +0 -25
- package/src/stubs/arquebus.config-ts.stub +0 -24
- package/src/stubs/model-js.stub +0 -5
- package/src/stubs/model-ts.stub +0 -5
|
@@ -248,7 +248,7 @@ declare class arquebus<M extends Model = Model> {
|
|
|
248
248
|
static setConnectorFactory(connectorFactory: typeof Knex$1): void;
|
|
249
249
|
static getConnectorFactory(): typeof Knex$1;
|
|
250
250
|
static addConnection(config: TConfig | TBaseConfig, name?: string): void;
|
|
251
|
-
static beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]
|
|
251
|
+
static beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>>;
|
|
252
252
|
static transaction(callback: TFunction, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
|
|
253
253
|
static table(name: string, connection?: null): IQueryBuilder<Model, Model | Model[]>;
|
|
254
254
|
static schema(connection?: null): SchemaBuilder;
|
|
@@ -268,7 +268,7 @@ declare class arquebus<M extends Model = Model> {
|
|
|
268
268
|
* @returns
|
|
269
269
|
*/
|
|
270
270
|
static autoLoad(addConnection?: boolean): Promise<TBaseConfig>;
|
|
271
|
-
beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]
|
|
271
|
+
beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>>;
|
|
272
272
|
transaction(callback: TFunction, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
|
|
273
273
|
table(name: string, connection?: null): IQueryBuilder<M, M | M[]>;
|
|
274
274
|
schema(connection?: null): SchemaBuilder;
|
|
@@ -989,9 +989,92 @@ interface JoinMethod<QB extends AnyQueryBuilder> {
|
|
|
989
989
|
(raw: Raw): QB;
|
|
990
990
|
}
|
|
991
991
|
//#endregion
|
|
992
|
+
//#region src/inspector/types/column.d.ts
|
|
993
|
+
interface Column {
|
|
994
|
+
name: string;
|
|
995
|
+
table: string;
|
|
996
|
+
data_type: string;
|
|
997
|
+
default_value: string | null;
|
|
998
|
+
max_length: number | null;
|
|
999
|
+
numeric_precision: number | null;
|
|
1000
|
+
numeric_scale: number | null;
|
|
1001
|
+
is_nullable: boolean;
|
|
1002
|
+
is_unique: boolean;
|
|
1003
|
+
is_primary_key: boolean;
|
|
1004
|
+
is_generated: boolean;
|
|
1005
|
+
generation_expression?: string | null;
|
|
1006
|
+
has_auto_increment: boolean;
|
|
1007
|
+
foreign_key_table: string | null;
|
|
1008
|
+
foreign_key_column: string | null;
|
|
1009
|
+
comment?: string | null;
|
|
1010
|
+
schema?: string;
|
|
1011
|
+
foreign_key_schema?: string | null;
|
|
1012
|
+
collation?: string | null;
|
|
1013
|
+
}
|
|
1014
|
+
//#endregion
|
|
1015
|
+
//#region src/inspector/types/foreign-key.d.ts
|
|
1016
|
+
type ForeignKey = {
|
|
1017
|
+
table: string;
|
|
1018
|
+
column: string;
|
|
1019
|
+
foreign_key_table: string;
|
|
1020
|
+
foreign_key_column: string;
|
|
1021
|
+
foreign_key_schema?: string;
|
|
1022
|
+
constraint_name: null | string;
|
|
1023
|
+
on_update: null | 'NO ACTION' | 'RESTRICT' | 'CASCADE' | 'SET NULL' | 'SET DEFAULT';
|
|
1024
|
+
on_delete: null | 'NO ACTION' | 'RESTRICT' | 'CASCADE' | 'SET NULL' | 'SET DEFAULT';
|
|
1025
|
+
};
|
|
1026
|
+
//#endregion
|
|
1027
|
+
//#region src/inspector/types/table.d.ts
|
|
1028
|
+
interface Table {
|
|
1029
|
+
name: string;
|
|
1030
|
+
comment?: string | null;
|
|
1031
|
+
schema?: string;
|
|
1032
|
+
collation?: string;
|
|
1033
|
+
engine?: string;
|
|
1034
|
+
owner?: string;
|
|
1035
|
+
sql?: string;
|
|
1036
|
+
catalog?: string;
|
|
1037
|
+
}
|
|
1038
|
+
//#endregion
|
|
992
1039
|
//#region types/query-builder.d.ts
|
|
993
1040
|
interface SchemaBuilder extends Knex.SchemaBuilder {
|
|
994
1041
|
[k: string]: any;
|
|
1042
|
+
/**
|
|
1043
|
+
* Retrieve all tables in the current database.
|
|
1044
|
+
*/
|
|
1045
|
+
tables(): Promise<string[]>;
|
|
1046
|
+
/**
|
|
1047
|
+
* Retrieve the table info for the given table, or all tables if no table is specified.
|
|
1048
|
+
*
|
|
1049
|
+
* @param table
|
|
1050
|
+
*/
|
|
1051
|
+
tableInfo(table?: string): Promise<Table | Table[]>;
|
|
1052
|
+
/**
|
|
1053
|
+
* Retrieve all columns in a given table, or all columns if no table is specified.
|
|
1054
|
+
*
|
|
1055
|
+
* @param table
|
|
1056
|
+
*/
|
|
1057
|
+
columns(table?: string): Promise<{
|
|
1058
|
+
table: string;
|
|
1059
|
+
column: string;
|
|
1060
|
+
}[]>;
|
|
1061
|
+
/**
|
|
1062
|
+
* Retrieve all columns from a given table. Returns all columns if table parameter is undefined.
|
|
1063
|
+
*
|
|
1064
|
+
* @param table
|
|
1065
|
+
* @param column
|
|
1066
|
+
*/
|
|
1067
|
+
columnInfo(table?: string, column?: string): Promise<Column[] | Column>;
|
|
1068
|
+
/**
|
|
1069
|
+
* Retrieve the primary key column for a given table.
|
|
1070
|
+
*
|
|
1071
|
+
* @param table
|
|
1072
|
+
*/
|
|
1073
|
+
primary(table: string): Promise<string>;
|
|
1074
|
+
/**
|
|
1075
|
+
* Retrieve all configured foreign key constraints
|
|
1076
|
+
*/
|
|
1077
|
+
foreignKeys(): Promise<ForeignKey>;
|
|
995
1078
|
}
|
|
996
1079
|
interface AsMethod<QB extends AnyQueryBuilder> {
|
|
997
1080
|
(alias: string): QB;
|
|
@@ -1122,7 +1205,7 @@ interface IQueryBuilder<M extends Model | Model$1 = Model, R = M[] | M> {
|
|
|
1122
1205
|
take(count: number): this;
|
|
1123
1206
|
limit(count: number): this;
|
|
1124
1207
|
offset(count: number): this;
|
|
1125
|
-
pluck<X extends Model = any>(column: string): Promise<
|
|
1208
|
+
pluck<X extends Model = any>(column: string): Promise<Array<X>>;
|
|
1126
1209
|
chunk(count: number, callback: (rows: M[]) => any): Promise<boolean>;
|
|
1127
1210
|
forPage(page: number, perPage?: number): this;
|
|
1128
1211
|
paginate<F extends IPaginatorParams>(page?: number, perPage?: number): Promise<IPaginator<M, F>>;
|
|
@@ -1135,10 +1218,13 @@ declare const Inference$1: {
|
|
|
1135
1218
|
declare class QueryBuilder<M extends Model = Model, R = M[] | M> extends Inference$1<M, R> {
|
|
1136
1219
|
model: M;
|
|
1137
1220
|
schema: SchemaBuilder;
|
|
1138
|
-
|
|
1221
|
+
connector: IQueryBuilder<M, R> & Knex.QueryBuilder & {
|
|
1222
|
+
_statements: any[];
|
|
1223
|
+
_single: any;
|
|
1224
|
+
} & Knex;
|
|
1139
1225
|
constructor(config: TConfig | null, connector: TFunction);
|
|
1140
1226
|
asProxy(): any;
|
|
1141
|
-
beginTransaction(): Promise<Knex.Transaction<any, any[]
|
|
1227
|
+
beginTransaction(): Promise<Knex.Transaction<any, any[]>>;
|
|
1142
1228
|
table<X extends M>(table: string): IQueryBuilder<X, R>;
|
|
1143
1229
|
transaction(callback?: TFunction): Promise<Knex.Transaction> | undefined;
|
|
1144
1230
|
find(id: string | number, columns?: string[]): Promise<any>;
|
|
@@ -1162,7 +1248,7 @@ declare class QueryBuilder<M extends Model = Model, R = M[] | M> extends Inferen
|
|
|
1162
1248
|
destroy(...args: Parameters<typeof (void 0).connector.destroy>): Promise<number>;
|
|
1163
1249
|
get _statements(): IStatement[] & any[];
|
|
1164
1250
|
get _single(): any;
|
|
1165
|
-
get from(): Knex.Table<any, any>;
|
|
1251
|
+
get from(): Knex.Table<any, any> & Knex.Table<any, any[]>;
|
|
1166
1252
|
}
|
|
1167
1253
|
declare namespace migration_d_exports {
|
|
1168
1254
|
export { IMigration, Migration, Migration as default };
|
|
@@ -1188,7 +1274,7 @@ declare class MigrationRepository {
|
|
|
1188
1274
|
table: string;
|
|
1189
1275
|
connection: TBaseConfig['client'] | null;
|
|
1190
1276
|
constructor(resolver: typeof arquebus, table: string);
|
|
1191
|
-
getRan(): Promise<
|
|
1277
|
+
getRan(): Promise<any[]>;
|
|
1192
1278
|
getMigrations(steps: number): Promise<any>;
|
|
1193
1279
|
getMigrationsByBatch(batch: number): Promise<any>;
|
|
1194
1280
|
getLast(): Promise<any>;
|
|
@@ -1211,6 +1297,7 @@ interface MigrationOptions {
|
|
|
1211
1297
|
pretend?: boolean;
|
|
1212
1298
|
step?: number;
|
|
1213
1299
|
batch?: number;
|
|
1300
|
+
quiet?: boolean;
|
|
1214
1301
|
}
|
|
1215
1302
|
declare class Migrator {
|
|
1216
1303
|
events: any;
|
|
@@ -1235,7 +1322,14 @@ declare class Migrator {
|
|
|
1235
1322
|
rollbackMigrations(migrations: {
|
|
1236
1323
|
migration: string;
|
|
1237
1324
|
}[], paths: string[], options: MigrationOptions): Promise<string[]>;
|
|
1238
|
-
reset(
|
|
1325
|
+
reset(paths: string[] | undefined, options: MigrationOptions, pretend?: boolean): Promise<string[]>;
|
|
1326
|
+
/**
|
|
1327
|
+
* Drop all tables and re-run all migrations
|
|
1328
|
+
*
|
|
1329
|
+
* @param paths
|
|
1330
|
+
* @param options
|
|
1331
|
+
*/
|
|
1332
|
+
fresh(paths: string[], options: MigrationOptions): Promise<void>;
|
|
1239
1333
|
resetMigrations(migrations: {
|
|
1240
1334
|
migration: string;
|
|
1241
1335
|
}[], paths: string[], pretend?: boolean): Promise<string[]>;
|
|
@@ -1255,7 +1349,6 @@ declare class Migrator {
|
|
|
1255
1349
|
deleteRepository(): void;
|
|
1256
1350
|
setOutput(output: boolean): this;
|
|
1257
1351
|
write(...args: any[]): void;
|
|
1258
|
-
writeTask(description: string, task: () => Promise<any> | any): Promise<void>;
|
|
1259
1352
|
}
|
|
1260
1353
|
//#endregion
|
|
1261
1354
|
//#region src/migrate.d.ts
|
|
@@ -1269,6 +1362,7 @@ interface MigrateOptions {
|
|
|
1269
1362
|
step?: number;
|
|
1270
1363
|
pretend?: boolean;
|
|
1271
1364
|
batch?: number;
|
|
1365
|
+
quiet?: boolean;
|
|
1272
1366
|
}
|
|
1273
1367
|
type TXBaseConfig<S = boolean> = (S extends true ? Partial<TBaseConfig> : TBaseConfig) & {
|
|
1274
1368
|
/**
|
|
@@ -1300,6 +1394,30 @@ declare class Migrate {
|
|
|
1300
1394
|
* @param destroyAll
|
|
1301
1395
|
*/
|
|
1302
1396
|
rollback(config: TXBaseConfig, options?: MigrateOptions, destroyAll?: boolean): Promise<void>;
|
|
1397
|
+
/**
|
|
1398
|
+
* Rollback all database migrations
|
|
1399
|
+
*
|
|
1400
|
+
* @param config
|
|
1401
|
+
* @param options
|
|
1402
|
+
* @param destroyAll
|
|
1403
|
+
*/
|
|
1404
|
+
reset(config: TXBaseConfig, options?: MigrateOptions, destroyAll?: boolean): Promise<void>;
|
|
1405
|
+
/**
|
|
1406
|
+
* Reset and re-run all migrations
|
|
1407
|
+
*
|
|
1408
|
+
* @param config
|
|
1409
|
+
* @param options
|
|
1410
|
+
* @param destroyAll
|
|
1411
|
+
*/
|
|
1412
|
+
refresh(config: TXBaseConfig, options?: MigrateOptions, destroyAll?: boolean): Promise<void>;
|
|
1413
|
+
/**
|
|
1414
|
+
* Drop all tables and re-run all migrations
|
|
1415
|
+
*
|
|
1416
|
+
* @param config
|
|
1417
|
+
* @param options
|
|
1418
|
+
* @param destroyAll
|
|
1419
|
+
*/
|
|
1420
|
+
fresh(config: TXBaseConfig, options?: MigrateOptions, destroyAll?: boolean): Promise<void>;
|
|
1303
1421
|
/**
|
|
1304
1422
|
* Prepares the database for migration
|
|
1305
1423
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Knex$1, { Knex } from "knex";
|
|
2
1
|
import { Collection } from "collect.js";
|
|
2
|
+
import Knex$1, { Knex } from "knex";
|
|
3
3
|
|
|
4
4
|
//#region src/collection.d.ts
|
|
5
5
|
declare class Collection$1<I extends Model | Model$1> extends Collection<I> implements ICollection<I> {
|
|
@@ -245,7 +245,7 @@ declare class arquebus<M extends Model = Model> {
|
|
|
245
245
|
static setConnectorFactory(connectorFactory: typeof Knex$1): void;
|
|
246
246
|
static getConnectorFactory(): typeof Knex$1;
|
|
247
247
|
static addConnection(config: TConfig | TBaseConfig, name?: string): void;
|
|
248
|
-
static beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]
|
|
248
|
+
static beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>>;
|
|
249
249
|
static transaction(callback: TFunction, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
|
|
250
250
|
static table(name: string, connection?: null): IQueryBuilder<Model, Model | Model[]>;
|
|
251
251
|
static schema(connection?: null): SchemaBuilder;
|
|
@@ -265,7 +265,7 @@ declare class arquebus<M extends Model = Model> {
|
|
|
265
265
|
* @returns
|
|
266
266
|
*/
|
|
267
267
|
static autoLoad(addConnection?: boolean): Promise<TBaseConfig>;
|
|
268
|
-
beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]
|
|
268
|
+
beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>>;
|
|
269
269
|
transaction(callback: TFunction, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
|
|
270
270
|
table(name: string, connection?: null): IQueryBuilder<M, M | M[]>;
|
|
271
271
|
schema(connection?: null): SchemaBuilder;
|
|
@@ -986,9 +986,92 @@ interface JoinMethod<QB extends AnyQueryBuilder> {
|
|
|
986
986
|
(raw: Raw): QB;
|
|
987
987
|
}
|
|
988
988
|
//#endregion
|
|
989
|
+
//#region src/inspector/types/column.d.ts
|
|
990
|
+
interface Column {
|
|
991
|
+
name: string;
|
|
992
|
+
table: string;
|
|
993
|
+
data_type: string;
|
|
994
|
+
default_value: string | null;
|
|
995
|
+
max_length: number | null;
|
|
996
|
+
numeric_precision: number | null;
|
|
997
|
+
numeric_scale: number | null;
|
|
998
|
+
is_nullable: boolean;
|
|
999
|
+
is_unique: boolean;
|
|
1000
|
+
is_primary_key: boolean;
|
|
1001
|
+
is_generated: boolean;
|
|
1002
|
+
generation_expression?: string | null;
|
|
1003
|
+
has_auto_increment: boolean;
|
|
1004
|
+
foreign_key_table: string | null;
|
|
1005
|
+
foreign_key_column: string | null;
|
|
1006
|
+
comment?: string | null;
|
|
1007
|
+
schema?: string;
|
|
1008
|
+
foreign_key_schema?: string | null;
|
|
1009
|
+
collation?: string | null;
|
|
1010
|
+
}
|
|
1011
|
+
//#endregion
|
|
1012
|
+
//#region src/inspector/types/foreign-key.d.ts
|
|
1013
|
+
type ForeignKey = {
|
|
1014
|
+
table: string;
|
|
1015
|
+
column: string;
|
|
1016
|
+
foreign_key_table: string;
|
|
1017
|
+
foreign_key_column: string;
|
|
1018
|
+
foreign_key_schema?: string;
|
|
1019
|
+
constraint_name: null | string;
|
|
1020
|
+
on_update: null | 'NO ACTION' | 'RESTRICT' | 'CASCADE' | 'SET NULL' | 'SET DEFAULT';
|
|
1021
|
+
on_delete: null | 'NO ACTION' | 'RESTRICT' | 'CASCADE' | 'SET NULL' | 'SET DEFAULT';
|
|
1022
|
+
};
|
|
1023
|
+
//#endregion
|
|
1024
|
+
//#region src/inspector/types/table.d.ts
|
|
1025
|
+
interface Table {
|
|
1026
|
+
name: string;
|
|
1027
|
+
comment?: string | null;
|
|
1028
|
+
schema?: string;
|
|
1029
|
+
collation?: string;
|
|
1030
|
+
engine?: string;
|
|
1031
|
+
owner?: string;
|
|
1032
|
+
sql?: string;
|
|
1033
|
+
catalog?: string;
|
|
1034
|
+
}
|
|
1035
|
+
//#endregion
|
|
989
1036
|
//#region types/query-builder.d.ts
|
|
990
1037
|
interface SchemaBuilder extends Knex.SchemaBuilder {
|
|
991
1038
|
[k: string]: any;
|
|
1039
|
+
/**
|
|
1040
|
+
* Retrieve all tables in the current database.
|
|
1041
|
+
*/
|
|
1042
|
+
tables(): Promise<string[]>;
|
|
1043
|
+
/**
|
|
1044
|
+
* Retrieve the table info for the given table, or all tables if no table is specified.
|
|
1045
|
+
*
|
|
1046
|
+
* @param table
|
|
1047
|
+
*/
|
|
1048
|
+
tableInfo(table?: string): Promise<Table | Table[]>;
|
|
1049
|
+
/**
|
|
1050
|
+
* Retrieve all columns in a given table, or all columns if no table is specified.
|
|
1051
|
+
*
|
|
1052
|
+
* @param table
|
|
1053
|
+
*/
|
|
1054
|
+
columns(table?: string): Promise<{
|
|
1055
|
+
table: string;
|
|
1056
|
+
column: string;
|
|
1057
|
+
}[]>;
|
|
1058
|
+
/**
|
|
1059
|
+
* Retrieve all columns from a given table. Returns all columns if table parameter is undefined.
|
|
1060
|
+
*
|
|
1061
|
+
* @param table
|
|
1062
|
+
* @param column
|
|
1063
|
+
*/
|
|
1064
|
+
columnInfo(table?: string, column?: string): Promise<Column[] | Column>;
|
|
1065
|
+
/**
|
|
1066
|
+
* Retrieve the primary key column for a given table.
|
|
1067
|
+
*
|
|
1068
|
+
* @param table
|
|
1069
|
+
*/
|
|
1070
|
+
primary(table: string): Promise<string>;
|
|
1071
|
+
/**
|
|
1072
|
+
* Retrieve all configured foreign key constraints
|
|
1073
|
+
*/
|
|
1074
|
+
foreignKeys(): Promise<ForeignKey>;
|
|
992
1075
|
}
|
|
993
1076
|
interface AsMethod<QB extends AnyQueryBuilder> {
|
|
994
1077
|
(alias: string): QB;
|
|
@@ -1119,7 +1202,7 @@ interface IQueryBuilder<M extends Model | Model$1 = Model, R = M[] | M> {
|
|
|
1119
1202
|
take(count: number): this;
|
|
1120
1203
|
limit(count: number): this;
|
|
1121
1204
|
offset(count: number): this;
|
|
1122
|
-
pluck<X extends Model = any>(column: string): Promise<
|
|
1205
|
+
pluck<X extends Model = any>(column: string): Promise<Array<X>>;
|
|
1123
1206
|
chunk(count: number, callback: (rows: M[]) => any): Promise<boolean>;
|
|
1124
1207
|
forPage(page: number, perPage?: number): this;
|
|
1125
1208
|
paginate<F extends IPaginatorParams>(page?: number, perPage?: number): Promise<IPaginator<M, F>>;
|
|
@@ -1132,10 +1215,13 @@ declare const Inference$1: {
|
|
|
1132
1215
|
declare class QueryBuilder<M extends Model = Model, R = M[] | M> extends Inference$1<M, R> {
|
|
1133
1216
|
model: M;
|
|
1134
1217
|
schema: SchemaBuilder;
|
|
1135
|
-
|
|
1218
|
+
connector: IQueryBuilder<M, R> & Knex.QueryBuilder & {
|
|
1219
|
+
_statements: any[];
|
|
1220
|
+
_single: any;
|
|
1221
|
+
} & Knex;
|
|
1136
1222
|
constructor(config: TConfig | null, connector: TFunction);
|
|
1137
1223
|
asProxy(): any;
|
|
1138
|
-
beginTransaction(): Promise<Knex.Transaction<any, any[]
|
|
1224
|
+
beginTransaction(): Promise<Knex.Transaction<any, any[]>>;
|
|
1139
1225
|
table<X extends M>(table: string): IQueryBuilder<X, R>;
|
|
1140
1226
|
transaction(callback?: TFunction): Promise<Knex.Transaction> | undefined;
|
|
1141
1227
|
find(id: string | number, columns?: string[]): Promise<any>;
|
|
@@ -1159,7 +1245,7 @@ declare class QueryBuilder<M extends Model = Model, R = M[] | M> extends Inferen
|
|
|
1159
1245
|
destroy(...args: Parameters<typeof (void 0).connector.destroy>): Promise<number>;
|
|
1160
1246
|
get _statements(): IStatement[] & any[];
|
|
1161
1247
|
get _single(): any;
|
|
1162
|
-
get from(): Knex.Table<any, any>;
|
|
1248
|
+
get from(): Knex.Table<any, any> & Knex.Table<any, any[]>;
|
|
1163
1249
|
}
|
|
1164
1250
|
declare namespace migration_d_exports {
|
|
1165
1251
|
export { IMigration, Migration, Migration as default };
|
|
@@ -1185,7 +1271,7 @@ declare class MigrationRepository {
|
|
|
1185
1271
|
table: string;
|
|
1186
1272
|
connection: TBaseConfig['client'] | null;
|
|
1187
1273
|
constructor(resolver: typeof arquebus, table: string);
|
|
1188
|
-
getRan(): Promise<
|
|
1274
|
+
getRan(): Promise<any[]>;
|
|
1189
1275
|
getMigrations(steps: number): Promise<any>;
|
|
1190
1276
|
getMigrationsByBatch(batch: number): Promise<any>;
|
|
1191
1277
|
getLast(): Promise<any>;
|
|
@@ -1208,6 +1294,7 @@ interface MigrationOptions {
|
|
|
1208
1294
|
pretend?: boolean;
|
|
1209
1295
|
step?: number;
|
|
1210
1296
|
batch?: number;
|
|
1297
|
+
quiet?: boolean;
|
|
1211
1298
|
}
|
|
1212
1299
|
declare class Migrator {
|
|
1213
1300
|
events: any;
|
|
@@ -1232,7 +1319,14 @@ declare class Migrator {
|
|
|
1232
1319
|
rollbackMigrations(migrations: {
|
|
1233
1320
|
migration: string;
|
|
1234
1321
|
}[], paths: string[], options: MigrationOptions): Promise<string[]>;
|
|
1235
|
-
reset(
|
|
1322
|
+
reset(paths: string[] | undefined, options: MigrationOptions, pretend?: boolean): Promise<string[]>;
|
|
1323
|
+
/**
|
|
1324
|
+
* Drop all tables and re-run all migrations
|
|
1325
|
+
*
|
|
1326
|
+
* @param paths
|
|
1327
|
+
* @param options
|
|
1328
|
+
*/
|
|
1329
|
+
fresh(paths: string[], options: MigrationOptions): Promise<void>;
|
|
1236
1330
|
resetMigrations(migrations: {
|
|
1237
1331
|
migration: string;
|
|
1238
1332
|
}[], paths: string[], pretend?: boolean): Promise<string[]>;
|
|
@@ -1252,7 +1346,6 @@ declare class Migrator {
|
|
|
1252
1346
|
deleteRepository(): void;
|
|
1253
1347
|
setOutput(output: boolean): this;
|
|
1254
1348
|
write(...args: any[]): void;
|
|
1255
|
-
writeTask(description: string, task: () => Promise<any> | any): Promise<void>;
|
|
1256
1349
|
}
|
|
1257
1350
|
//#endregion
|
|
1258
1351
|
//#region src/migrate.d.ts
|
|
@@ -1266,6 +1359,7 @@ interface MigrateOptions {
|
|
|
1266
1359
|
step?: number;
|
|
1267
1360
|
pretend?: boolean;
|
|
1268
1361
|
batch?: number;
|
|
1362
|
+
quiet?: boolean;
|
|
1269
1363
|
}
|
|
1270
1364
|
type TXBaseConfig<S = boolean> = (S extends true ? Partial<TBaseConfig> : TBaseConfig) & {
|
|
1271
1365
|
/**
|
|
@@ -1297,6 +1391,30 @@ declare class Migrate {
|
|
|
1297
1391
|
* @param destroyAll
|
|
1298
1392
|
*/
|
|
1299
1393
|
rollback(config: TXBaseConfig, options?: MigrateOptions, destroyAll?: boolean): Promise<void>;
|
|
1394
|
+
/**
|
|
1395
|
+
* Rollback all database migrations
|
|
1396
|
+
*
|
|
1397
|
+
* @param config
|
|
1398
|
+
* @param options
|
|
1399
|
+
* @param destroyAll
|
|
1400
|
+
*/
|
|
1401
|
+
reset(config: TXBaseConfig, options?: MigrateOptions, destroyAll?: boolean): Promise<void>;
|
|
1402
|
+
/**
|
|
1403
|
+
* Reset and re-run all migrations
|
|
1404
|
+
*
|
|
1405
|
+
* @param config
|
|
1406
|
+
* @param options
|
|
1407
|
+
* @param destroyAll
|
|
1408
|
+
*/
|
|
1409
|
+
refresh(config: TXBaseConfig, options?: MigrateOptions, destroyAll?: boolean): Promise<void>;
|
|
1410
|
+
/**
|
|
1411
|
+
* Drop all tables and re-run all migrations
|
|
1412
|
+
*
|
|
1413
|
+
* @param config
|
|
1414
|
+
* @param options
|
|
1415
|
+
* @param destroyAll
|
|
1416
|
+
*/
|
|
1417
|
+
fresh(config: TXBaseConfig, options?: MigrateOptions, destroyAll?: boolean): Promise<void>;
|
|
1300
1418
|
/**
|
|
1301
1419
|
* Prepares the database for migration
|
|
1302
1420
|
*
|