rake-db 2.5.0 → 2.7.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 +166 -36
- package/dist/index.js +92 -133
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +95 -135
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import * as pqb from 'pqb';
|
|
2
|
+
import { ColumnsShape, Db as Db$1, ColumnType, EnumColumn, Adapter, DefaultColumnTypes, DbResult, TransactionAdapter, QueryLogObject, IndexColumnOptions, IndexOptions, ForeignKeyOptions, TextColumn, NoPrimaryKeyOption, TableData, SingleColumnIndexOptions, AdapterOptions, QueryLogOptions } from 'pqb';
|
|
3
|
+
import * as orchid_core from 'orchid-core';
|
|
4
|
+
import { ColumnTypesBase, EmptyObject, RawExpression, raw, MaybeArray } from 'orchid-core';
|
|
3
5
|
|
|
4
6
|
type CreateTableResult<Table extends string, Shape extends ColumnsShape> = {
|
|
5
7
|
table: Db$1<Table, Shape>;
|
|
@@ -29,7 +31,7 @@ declare const tableChangeMethods: {
|
|
|
29
31
|
rename(name: string): RakeDbAst.ChangeTableItem.Rename;
|
|
30
32
|
enum(this: ColumnTypesBase, name: string): EnumColumn<string, [string, ...string[]]>;
|
|
31
33
|
};
|
|
32
|
-
type TableChanger = MigrationColumnTypes & TableChangeMethods;
|
|
34
|
+
type TableChanger<CT extends ColumnTypesBase> = MigrationColumnTypes<CT> & TableChangeMethods;
|
|
33
35
|
type TableChangeData = Record<string, RakeDbAst.ChangeTableItem.Column | RakeDbAst.ChangeTableItem.Rename | Change | EmptyObject>;
|
|
34
36
|
|
|
35
37
|
type DropMode = 'CASCADE' | 'RESTRICT';
|
|
@@ -40,20 +42,20 @@ type TableOptions = {
|
|
|
40
42
|
snakeCase?: boolean;
|
|
41
43
|
};
|
|
42
44
|
type TextColumnCreator = () => TextColumn;
|
|
43
|
-
type MigrationColumnTypes = Omit<
|
|
45
|
+
type MigrationColumnTypes<CT extends ColumnTypesBase> = Omit<CT, 'text' | 'string' | 'enum'> & {
|
|
44
46
|
text: TextColumnCreator;
|
|
45
47
|
string: TextColumnCreator;
|
|
46
48
|
citext: TextColumnCreator;
|
|
47
49
|
enum: (name: string) => EnumColumn;
|
|
48
50
|
};
|
|
49
|
-
type ColumnsShapeCallback<Shape extends ColumnsShape = ColumnsShape> = (t: MigrationColumnTypes & {
|
|
51
|
+
type ColumnsShapeCallback<CT extends ColumnTypesBase, Shape extends ColumnsShape = ColumnsShape> = (t: MigrationColumnTypes<CT> & {
|
|
50
52
|
raw: typeof raw;
|
|
51
53
|
}) => Shape;
|
|
52
54
|
type ChangeTableOptions = {
|
|
53
55
|
snakeCase?: boolean;
|
|
54
56
|
comment?: string | [string, string] | null;
|
|
55
57
|
};
|
|
56
|
-
type ChangeTableCallback = (t: TableChanger) => TableChangeData;
|
|
58
|
+
type ChangeTableCallback<CT extends ColumnTypesBase> = (t: TableChanger<CT>) => TableChangeData;
|
|
57
59
|
type ColumnComment = {
|
|
58
60
|
column: string;
|
|
59
61
|
comment: string | null;
|
|
@@ -62,7 +64,7 @@ type SilentQueries = {
|
|
|
62
64
|
silentQuery: Adapter['query'];
|
|
63
65
|
silentArrays: Adapter['arrays'];
|
|
64
66
|
};
|
|
65
|
-
type Migration = DbResult<
|
|
67
|
+
type Migration<CT extends ColumnTypesBase = DefaultColumnTypes> = DbResult<CT> & MigrationBase<CT> & {
|
|
66
68
|
adapter: SilentQueries;
|
|
67
69
|
};
|
|
68
70
|
type ConstraintArg = {
|
|
@@ -76,22 +78,23 @@ type ConstraintArg = {
|
|
|
76
78
|
check?: RawExpression;
|
|
77
79
|
dropMode?: DropMode;
|
|
78
80
|
};
|
|
79
|
-
declare const createMigrationInterface: (tx: TransactionAdapter, up: boolean,
|
|
80
|
-
declare class MigrationBase {
|
|
81
|
+
declare const createMigrationInterface: <CT extends ColumnTypesBase>(tx: TransactionAdapter, up: boolean, config: RakeDbConfig<CT>) => Migration;
|
|
82
|
+
declare class MigrationBase<CT extends ColumnTypesBase> {
|
|
81
83
|
adapter: TransactionAdapter;
|
|
82
84
|
log?: QueryLogObject;
|
|
83
85
|
up: boolean;
|
|
84
86
|
options: RakeDbConfig;
|
|
85
87
|
migratedAsts: RakeDbAst[];
|
|
86
|
-
|
|
87
|
-
createTable<Table extends string, Shape extends ColumnsShape>(tableName: Table, fn: ColumnsShapeCallback<Shape>): Promise<CreateTableResult<Table, Shape>>;
|
|
88
|
-
|
|
89
|
-
dropTable<Table extends string, Shape extends ColumnsShape>(tableName: Table, fn: ColumnsShapeCallback<Shape>): Promise<CreateTableResult<Table, Shape>>;
|
|
90
|
-
|
|
91
|
-
changeTable(tableName: string,
|
|
88
|
+
columnTypes: CT;
|
|
89
|
+
createTable<Table extends string, Shape extends ColumnsShape>(tableName: Table, options: TableOptions, fn: ColumnsShapeCallback<CT, Shape>): Promise<CreateTableResult<Table, Shape>>;
|
|
90
|
+
createTable<Table extends string, Shape extends ColumnsShape>(tableName: Table, fn: ColumnsShapeCallback<CT, Shape>): Promise<CreateTableResult<Table, Shape>>;
|
|
91
|
+
dropTable<Table extends string, Shape extends ColumnsShape>(tableName: Table, options: TableOptions, fn: ColumnsShapeCallback<CT, Shape>): Promise<CreateTableResult<Table, Shape>>;
|
|
92
|
+
dropTable<Table extends string, Shape extends ColumnsShape>(tableName: Table, fn: ColumnsShapeCallback<CT, Shape>): Promise<CreateTableResult<Table, Shape>>;
|
|
93
|
+
changeTable(tableName: string, options: ChangeTableOptions, fn?: ChangeTableCallback<CT>): Promise<void>;
|
|
94
|
+
changeTable(tableName: string, fn: ChangeTableCallback<CT>): Promise<void>;
|
|
92
95
|
renameTable(from: string, to: string): Promise<void>;
|
|
93
|
-
addColumn(tableName: string, columnName: string, fn: (t: MigrationColumnTypes) => ColumnType): Promise<void>;
|
|
94
|
-
dropColumn(tableName: string, columnName: string, fn: (t: MigrationColumnTypes) => ColumnType): Promise<void>;
|
|
96
|
+
addColumn(tableName: string, columnName: string, fn: (t: MigrationColumnTypes<CT>) => ColumnType): Promise<void>;
|
|
97
|
+
dropColumn(tableName: string, columnName: string, fn: (t: MigrationColumnTypes<CT>) => ColumnType): Promise<void>;
|
|
95
98
|
addIndex(tableName: string, columns: MaybeArray<string | IndexColumnOptions>, options?: IndexOptions): Promise<void>;
|
|
96
99
|
dropIndex(tableName: string, columns: MaybeArray<string | IndexColumnOptions>, options?: IndexOptions): Promise<void>;
|
|
97
100
|
addForeignKey(tableName: string, columns: [string, ...string[]], foreignTable: string, foreignColumns: [string, ...string[]], options?: ForeignKeyOptions): Promise<void>;
|
|
@@ -113,8 +116,8 @@ declare class MigrationBase {
|
|
|
113
116
|
dropExtension(name: string, options?: Omit<RakeDbAst.Extension, 'type' | 'action' | 'name' | 'values'>): Promise<void>;
|
|
114
117
|
createEnum(name: string, values: [string, ...string[]], options?: Omit<RakeDbAst.Enum, 'type' | 'action' | 'name' | 'values' | 'schema'>): Promise<void>;
|
|
115
118
|
dropEnum(name: string, values: [string, ...string[]], options?: Omit<RakeDbAst.Enum, 'type' | 'action' | 'name' | 'values' | 'schema'>): Promise<void>;
|
|
116
|
-
createDomain(name: string, fn: (t:
|
|
117
|
-
dropDomain(name: string, fn: (t:
|
|
119
|
+
createDomain(name: string, fn: (t: CT) => ColumnType, options?: Omit<RakeDbAst.Domain, 'type' | 'action' | 'schema' | 'name' | 'baseType'>): Promise<void>;
|
|
120
|
+
dropDomain(name: string, fn: (t: CT) => ColumnType, options?: Omit<RakeDbAst.Domain, 'type' | 'action' | 'schema' | 'name' | 'baseType'>): Promise<void>;
|
|
118
121
|
createView(name: string, options: RakeDbAst.ViewOptions, sql: string | RawExpression): Promise<void>;
|
|
119
122
|
createView(name: string, sql: string | RawExpression): Promise<void>;
|
|
120
123
|
dropView(name: string, options: RakeDbAst.ViewOptions, sql: string | RawExpression): Promise<void>;
|
|
@@ -259,12 +262,22 @@ declare namespace RakeDbAst {
|
|
|
259
262
|
}
|
|
260
263
|
|
|
261
264
|
type Db = DbResult<DefaultColumnTypes>;
|
|
262
|
-
type
|
|
265
|
+
type InputRakeDbConfig<CT extends ColumnTypesBase> = Partial<Omit<RakeDbConfig<CT>, 'columnTypes'>> & ({
|
|
266
|
+
columnTypes?: CT | ((t: DefaultColumnTypes) => CT);
|
|
267
|
+
} | {
|
|
268
|
+
baseTable?: new () => {
|
|
269
|
+
columnTypes: CT;
|
|
270
|
+
snakeCase?: boolean;
|
|
271
|
+
};
|
|
272
|
+
});
|
|
273
|
+
type RakeDbConfig<CT extends ColumnTypesBase = DefaultColumnTypes> = {
|
|
274
|
+
columnTypes: CT;
|
|
263
275
|
basePath: string;
|
|
276
|
+
dbScript: string;
|
|
264
277
|
migrationsPath: string;
|
|
265
278
|
migrationsTable: string;
|
|
266
279
|
snakeCase: boolean;
|
|
267
|
-
commands: Record<string, (options: AdapterOptions[], config: RakeDbConfig
|
|
280
|
+
commands: Record<string, (options: AdapterOptions[], config: RakeDbConfig<CT>, args: string[]) => Promise<void>>;
|
|
268
281
|
import(path: string): Promise<void>;
|
|
269
282
|
noPrimaryKey?: NoPrimaryKeyOption;
|
|
270
283
|
appCodeUpdater?: AppCodeUpdater;
|
|
@@ -282,27 +295,144 @@ type AppCodeUpdater = (params: {
|
|
|
282
295
|
logger: QueryLogOptions['logger'];
|
|
283
296
|
}) => Promise<void>;
|
|
284
297
|
|
|
285
|
-
declare const createDb: (arg: MaybeArray<AdapterOptions>, config: RakeDbConfig) => Promise<void>;
|
|
298
|
+
declare const createDb: <CT extends ColumnTypesBase>(arg: MaybeArray<AdapterOptions>, config: RakeDbConfig<CT>) => Promise<void>;
|
|
286
299
|
declare const dropDb: (arg: MaybeArray<AdapterOptions>) => Promise<void>;
|
|
287
|
-
declare const resetDb: (arg: MaybeArray<AdapterOptions>, config: RakeDbConfig) => Promise<void>;
|
|
300
|
+
declare const resetDb: <CT extends ColumnTypesBase>(arg: MaybeArray<AdapterOptions>, config: RakeDbConfig<CT>) => Promise<void>;
|
|
288
301
|
|
|
289
|
-
declare const writeMigrationFile: (config: RakeDbConfig
|
|
290
|
-
declare const generate: (config: RakeDbConfig
|
|
302
|
+
declare const writeMigrationFile: <CT extends ColumnTypesBase>(config: RakeDbConfig<CT>, version: string, name: string, content: (importPath: string, name: string) => string) => Promise<void>;
|
|
303
|
+
declare const generate: <CT extends ColumnTypesBase>(config: RakeDbConfig<CT>, [name]: string[]) => Promise<void>;
|
|
291
304
|
declare const makeFileTimeStamp: () => string;
|
|
292
305
|
|
|
293
|
-
type ChangeCallback = (db: Migration
|
|
294
|
-
declare const change: (fn: ChangeCallback) => void;
|
|
306
|
+
type ChangeCallback<CT extends ColumnTypesBase = ColumnTypesBase> = (db: Migration<CT>, up: boolean) => Promise<void>;
|
|
295
307
|
|
|
296
|
-
declare const migrateOrRollback: (options: MaybeArray<AdapterOptions>, config: RakeDbConfig
|
|
308
|
+
declare const migrateOrRollback: <CT extends ColumnTypesBase>(options: MaybeArray<AdapterOptions>, config: RakeDbConfig<CT>, args: string[], up: boolean) => Promise<void>;
|
|
297
309
|
declare const changeCache: Record<string, ChangeCallback[] | undefined>;
|
|
298
|
-
declare const migrate: (options: MaybeArray<AdapterOptions>, config: RakeDbConfig
|
|
299
|
-
declare const rollback: (options: MaybeArray<AdapterOptions>, config: RakeDbConfig
|
|
300
|
-
declare const redo: (options: MaybeArray<AdapterOptions>, config: RakeDbConfig
|
|
310
|
+
declare const migrate: <CT extends ColumnTypesBase>(options: MaybeArray<AdapterOptions>, config: RakeDbConfig<CT>, args?: string[]) => Promise<void>;
|
|
311
|
+
declare const rollback: <CT extends ColumnTypesBase>(options: MaybeArray<AdapterOptions>, config: RakeDbConfig<CT>, args?: string[]) => Promise<void>;
|
|
312
|
+
declare const redo: <CT extends ColumnTypesBase>(options: MaybeArray<AdapterOptions>, config: RakeDbConfig<CT>, args?: string[]) => Promise<void>;
|
|
301
313
|
|
|
302
|
-
declare const rakeDb:
|
|
314
|
+
declare const rakeDb: <CT extends ColumnTypesBase = {
|
|
315
|
+
timestamps: <T extends orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>>(this: {
|
|
316
|
+
name(name: string): {
|
|
317
|
+
timestamp(): T;
|
|
318
|
+
};
|
|
319
|
+
timestamp(): T;
|
|
320
|
+
}) => {
|
|
321
|
+
createdAt: orchid_core.ColumnWithDefault<T, orchid_core.RawExpression>;
|
|
322
|
+
updatedAt: orchid_core.ColumnWithDefault<T, orchid_core.RawExpression>;
|
|
323
|
+
};
|
|
324
|
+
timestampsSnakeCase: <T_1 extends orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>>(this: {
|
|
325
|
+
name(name: string): {
|
|
326
|
+
timestamp(): T_1;
|
|
327
|
+
};
|
|
328
|
+
timestamp(): T_1;
|
|
329
|
+
}) => {
|
|
330
|
+
createdAt: orchid_core.ColumnWithDefault<T_1, orchid_core.RawExpression>;
|
|
331
|
+
updatedAt: orchid_core.ColumnWithDefault<T_1, orchid_core.RawExpression>;
|
|
332
|
+
};
|
|
333
|
+
name: typeof orchid_core.name;
|
|
334
|
+
raw: (sql: string, values?: false | Record<string, unknown> | undefined) => orchid_core.RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>>;
|
|
335
|
+
smallint(this: ColumnTypesBase): pqb.SmallIntColumn;
|
|
336
|
+
integer(this: ColumnTypesBase): pqb.IntegerColumn;
|
|
337
|
+
bigint(this: ColumnTypesBase): pqb.BigIntColumn;
|
|
338
|
+
numeric<Precision extends number | undefined = undefined, Scale extends number | undefined = undefined>(this: ColumnTypesBase, precision?: Precision | undefined, scale?: Scale | undefined): pqb.DecimalColumn<Precision, Scale>;
|
|
339
|
+
decimal<Precision_1 extends number | undefined = undefined, Scale_1 extends number | undefined = undefined>(this: ColumnTypesBase, precision?: Precision_1 | undefined, scale?: Scale_1 | undefined): pqb.DecimalColumn<Precision_1, Scale_1>;
|
|
340
|
+
real(this: ColumnTypesBase): pqb.RealColumn;
|
|
341
|
+
doublePrecision(this: ColumnTypesBase): pqb.DoublePrecisionColumn;
|
|
342
|
+
identity(this: ColumnTypesBase, options?: pqb.TableData.Identity | undefined): pqb.IntegerColumn;
|
|
343
|
+
smallSerial(this: ColumnTypesBase): pqb.SmallSerialColumn;
|
|
344
|
+
serial(this: ColumnTypesBase): pqb.SerialColumn;
|
|
345
|
+
bigSerial(this: ColumnTypesBase): pqb.BigSerialColumn;
|
|
346
|
+
money(this: ColumnTypesBase): pqb.MoneyColumn;
|
|
347
|
+
varchar<Limit extends number | undefined = undefined>(this: ColumnTypesBase, limit?: Limit | undefined): pqb.VarCharColumn<Limit>;
|
|
348
|
+
char<Limit_1 extends number | undefined = undefined>(this: ColumnTypesBase, limit?: Limit_1 | undefined): pqb.CharColumn<Limit_1>;
|
|
349
|
+
text: (this: ColumnTypesBase, min: number, max: number) => pqb.TextColumn;
|
|
350
|
+
string: (this: ColumnTypesBase, min: number, max: number) => pqb.TextColumn;
|
|
351
|
+
citext(this: ColumnTypesBase, min: number, max: number): pqb.CitextColumn;
|
|
352
|
+
bytea(this: ColumnTypesBase): pqb.ByteaColumn;
|
|
353
|
+
date(this: ColumnTypesBase): pqb.DateColumn;
|
|
354
|
+
timestampWithoutTimeZone<Precision_2 extends number>(this: ColumnTypesBase, precision?: Precision_2 | undefined): pqb.TimestampColumn<Precision_2>;
|
|
355
|
+
timestamp<Precision_3 extends number | undefined = undefined>(this: ColumnTypesBase, precision?: Precision_3 | undefined): pqb.TimestampTzColumn<number>;
|
|
356
|
+
time<Precision_4 extends number | undefined = undefined>(this: ColumnTypesBase, precision?: Precision_4 | undefined): pqb.TimeColumn<Precision_4>;
|
|
357
|
+
interval<Fields extends string | undefined = undefined, Precision_5 extends number | undefined = undefined>(this: ColumnTypesBase, fields?: Fields | undefined, precision?: Precision_5 | undefined): pqb.IntervalColumn<Fields, Precision_5>;
|
|
358
|
+
boolean(this: ColumnTypesBase): pqb.BooleanColumn;
|
|
359
|
+
enum<U extends string, T_2 extends [U, ...U[]]>(this: ColumnTypesBase, dataType: string, type: T_2): pqb.EnumColumn<U, T_2>;
|
|
360
|
+
point(this: ColumnTypesBase): pqb.PointColumn;
|
|
361
|
+
line(this: ColumnTypesBase): pqb.LineColumn;
|
|
362
|
+
lseg(this: ColumnTypesBase): pqb.LsegColumn;
|
|
363
|
+
box(this: ColumnTypesBase): pqb.BoxColumn;
|
|
364
|
+
path(this: ColumnTypesBase): pqb.PathColumn;
|
|
365
|
+
polygon(this: ColumnTypesBase): pqb.PolygonColumn;
|
|
366
|
+
circle(this: ColumnTypesBase): pqb.CircleColumn;
|
|
367
|
+
cidr(this: ColumnTypesBase): pqb.CidrColumn;
|
|
368
|
+
inet(this: ColumnTypesBase): pqb.InetColumn;
|
|
369
|
+
macaddr(this: ColumnTypesBase): pqb.MacAddrColumn;
|
|
370
|
+
macaddr8(this: ColumnTypesBase): pqb.MacAddr8Column;
|
|
371
|
+
bit<Length extends number>(this: ColumnTypesBase, length: Length): pqb.BitColumn<Length>;
|
|
372
|
+
bitVarying<Length_1 extends number | undefined = undefined>(this: ColumnTypesBase, length?: Length_1 | undefined): pqb.BitVaryingColumn<Length_1>;
|
|
373
|
+
tsvector(this: ColumnTypesBase): pqb.TsVectorColumn;
|
|
374
|
+
tsquery(this: ColumnTypesBase): pqb.TsQueryColumn;
|
|
375
|
+
uuid(this: ColumnTypesBase): pqb.UUIDColumn;
|
|
376
|
+
xml(this: ColumnTypesBase): pqb.XMLColumn;
|
|
377
|
+
json<Type extends orchid_core.JSONTypeAny>(this: ColumnTypesBase, schemaOrFn: Type | ((j: {
|
|
378
|
+
set: <Value extends orchid_core.JSONTypeAny>(valueType: Value) => orchid_core.JSONSet<Value>;
|
|
379
|
+
tuple: <T_3 extends [] | orchid_core.JSONTupleItems, Rest extends orchid_core.JSONTypeAny | null = null>(items: T_3, rest?: Rest) => orchid_core.JSONTuple<T_3, Rest>;
|
|
380
|
+
union: <T_4 extends [orchid_core.JSONTypeAny, orchid_core.JSONTypeAny, ...orchid_core.JSONTypeAny[]]>(types: T_4) => orchid_core.JSONUnion<T_4>;
|
|
381
|
+
any: () => orchid_core.JSONAny;
|
|
382
|
+
bigint: () => orchid_core.JSONBigInt;
|
|
383
|
+
boolean: () => orchid_core.JSONBoolean;
|
|
384
|
+
date: () => orchid_core.JSONDate;
|
|
385
|
+
nan: () => orchid_core.JSONNaN;
|
|
386
|
+
never: () => orchid_core.JSONNever;
|
|
387
|
+
null: () => orchid_core.JSONNull;
|
|
388
|
+
number: () => orchid_core.JSONNumber;
|
|
389
|
+
string: () => orchid_core.JSONString;
|
|
390
|
+
unknown: () => orchid_core.JSONUnknown;
|
|
391
|
+
array: <Type_1 extends orchid_core.JSONTypeAny>(element: Type_1) => orchid_core.JSONArray<Type_1, "many">;
|
|
392
|
+
discriminatedUnion: <Discriminator extends string, DiscriminatorValue extends orchid_core.Primitive, Types extends [orchid_core.JSONDiscriminatedObject<Discriminator, DiscriminatorValue>, orchid_core.JSONDiscriminatedObject<Discriminator, DiscriminatorValue>, ...orchid_core.JSONDiscriminatedObject<Discriminator, DiscriminatorValue>[]]>(discriminator: Discriminator, options: Types) => orchid_core.JSONDiscriminatedUnion<Discriminator, DiscriminatorValue, Types>;
|
|
393
|
+
enum: <U_1 extends string, T_5 extends [U_1, ...U_1[]]>(options: T_5) => orchid_core.JSONEnum<U_1, T_5>;
|
|
394
|
+
instanceOf: <T_6 extends new (...args: any[]) => any>(cls: T_6) => orchid_core.JSONInstanceOf<T_6>;
|
|
395
|
+
intersection: <Left extends orchid_core.JSONTypeAny, Right extends orchid_core.JSONTypeAny>(left: Left, right: Right) => orchid_core.JSONIntersection<Left, Right>;
|
|
396
|
+
lazy: <T_7 extends orchid_core.JSONTypeAny>(fn: () => T_7) => orchid_core.JSONLazy<T_7>;
|
|
397
|
+
literal: <T_8 extends orchid_core.Primitive>(value: T_8) => orchid_core.JSONLiteral<T_8>;
|
|
398
|
+
map: <Key extends orchid_core.JSONTypeAny, Value_1 extends orchid_core.JSONTypeAny>(keyType: Key, valueType: Value_1) => orchid_core.JSONMap<Key, Value_1>;
|
|
399
|
+
nativeEnum: <T_9 extends orchid_core.EnumLike>(givenEnum: T_9) => orchid_core.JSONNativeEnum<T_9>;
|
|
400
|
+
nullable: <T_10 extends orchid_core.JSONTypeAny>(type: T_10) => orchid_core.JSONNullable<T_10>;
|
|
401
|
+
nullish: <T_11 extends orchid_core.JSONTypeAny>(type: T_11) => orchid_core.JSONNullish<T_11>;
|
|
402
|
+
object: <T_12 extends orchid_core.JSONObjectShape, UnknownKeys extends orchid_core.UnknownKeysParam = "strip", Catchall extends orchid_core.JSONTypeAny = orchid_core.JSONTypeAny>(shape: T_12) => orchid_core.JSONObject<T_12, UnknownKeys, Catchall, orchid_core.JSONTypeAny extends Catchall ? orchid_core.addQuestionMarks<{ [k_1 in keyof T_12]: T_12[k_1]["type"]; }> extends infer T_13 extends object ? { [k in keyof T_13]: orchid_core.addQuestionMarks<{ [k_1 in keyof T_12]: T_12[k_1]["type"]; }>[k]; } : never : (orchid_core.addQuestionMarks<{ [k_1 in keyof T_12]: T_12[k_1]["type"]; }> extends infer T_16 extends object ? { [k in keyof T_16]: orchid_core.addQuestionMarks<{ [k_1 in keyof T_12]: T_12[k_1]["type"]; }>[k]; } : never) & {
|
|
403
|
+
[k: string]: Catchall["type"];
|
|
404
|
+
} extends infer T_14 extends object ? { [k_2 in keyof T_14]: ((orchid_core.addQuestionMarks<{ [k_1 in keyof T_12]: T_12[k_1]["type"]; }> extends infer T_15 extends object ? { [k in keyof T_15]: orchid_core.addQuestionMarks<{ [k_1 in keyof T_12]: T_12[k_1]["type"]; }>[k]; } : never) & {
|
|
405
|
+
[k: string]: Catchall["type"];
|
|
406
|
+
})[k_2]; } : never>;
|
|
407
|
+
optional: <T_17 extends orchid_core.JSONTypeAny>(type: T_17) => orchid_core.JSONOptional<T_17>;
|
|
408
|
+
record: typeof orchid_core.record;
|
|
409
|
+
}) => Type)): pqb.JSONColumn<Type>;
|
|
410
|
+
jsonText(this: ColumnTypesBase): pqb.JSONTextColumn;
|
|
411
|
+
array<Item extends pqb.ColumnType<unknown, orchid_core.BaseOperators, unknown>>(this: ColumnTypesBase, item: Item): pqb.ArrayColumn<Item>;
|
|
412
|
+
type(this: ColumnTypesBase, dataType: string): pqb.CustomTypeColumn;
|
|
413
|
+
domain(this: ColumnTypesBase, dataType: string): pqb.DomainColumn;
|
|
414
|
+
primaryKey(columns: string[], options?: {
|
|
415
|
+
name?: string | undefined;
|
|
416
|
+
} | undefined): {};
|
|
417
|
+
index(columns: MaybeArray<string | pqb.IndexColumnOptions>, options?: pqb.IndexOptions): {};
|
|
418
|
+
unique(columns: MaybeArray<string | pqb.IndexColumnOptions>, options?: pqb.IndexOptions): {};
|
|
419
|
+
constraint<Table extends string | (() => pqb.ForeignKeyTable), Columns extends Table extends () => pqb.ForeignKeyTable ? [pqb.ColumnNameOfTable<ReturnType<Table>>, ...pqb.ColumnNameOfTable<ReturnType<Table>>[]] : [string, ...string[]]>({ name, references, check, dropMode, }: {
|
|
420
|
+
name?: string | undefined;
|
|
421
|
+
references?: [columns: string[], fnOrTable: Table, foreignColumns: Columns, options?: pqb.ForeignKeyOptions | undefined] | undefined;
|
|
422
|
+
check?: orchid_core.RawExpression | undefined;
|
|
423
|
+
dropMode?: pqb.DropMode | undefined;
|
|
424
|
+
}): {};
|
|
425
|
+
foreignKey<Table_1 extends string | (() => pqb.ForeignKeyTable), Columns_1 extends Table_1 extends () => pqb.ForeignKeyTable ? [pqb.ColumnNameOfTable<ReturnType<Table_1>>, ...pqb.ColumnNameOfTable<ReturnType<Table_1>>[]] : [string, ...string[]]>(columns: string[], fnOrTable: Table_1, foreignColumns: Columns_1, options?: (pqb.ForeignKeyOptions & {
|
|
426
|
+
name?: string | undefined;
|
|
427
|
+
dropMode?: pqb.DropMode | undefined;
|
|
428
|
+
}) | undefined): {};
|
|
429
|
+
check(check: orchid_core.RawExpression): {};
|
|
430
|
+
}>(options: MaybeArray<AdapterOptions>, partialConfig?: InputRakeDbConfig<CT>, args?: string[]) => ((fn: ChangeCallback<CT>) => void) & {
|
|
431
|
+
promise: Promise<void>;
|
|
432
|
+
};
|
|
303
433
|
|
|
304
|
-
declare const saveMigratedVersion: (db: SilentQueries, version: string, config: RakeDbConfig) => Promise<void>;
|
|
305
|
-
declare const removeMigratedVersion: (db: SilentQueries, version: string, config: RakeDbConfig) => Promise<void>;
|
|
306
|
-
declare const getMigratedVersionsMap: (db: Adapter, config: RakeDbConfig) => Promise<Record<string, boolean>>;
|
|
434
|
+
declare const saveMigratedVersion: <CT extends ColumnTypesBase>(db: SilentQueries, version: string, config: RakeDbConfig<CT>) => Promise<void>;
|
|
435
|
+
declare const removeMigratedVersion: <CT extends ColumnTypesBase>(db: SilentQueries, version: string, config: RakeDbConfig<CT>) => Promise<void>;
|
|
436
|
+
declare const getMigratedVersionsMap: <CT extends ColumnTypesBase>(db: Adapter, config: RakeDbConfig<CT>) => Promise<Record<string, boolean>>;
|
|
307
437
|
|
|
308
|
-
export { AppCodeUpdater, ChangeTableCallback, ChangeTableOptions, ColumnComment, ColumnsShapeCallback, DropMode, Migration, MigrationBase, MigrationColumnTypes, RakeDbAst, RakeDbConfig, SilentQueries, TableOptions,
|
|
438
|
+
export { AppCodeUpdater, ChangeTableCallback, ChangeTableOptions, ColumnComment, ColumnsShapeCallback, DropMode, Migration, MigrationBase, MigrationColumnTypes, RakeDbAst, RakeDbConfig, SilentQueries, TableOptions, changeCache, createDb, createMigrationInterface, dropDb, generate, getMigratedVersionsMap, makeFileTimeStamp, migrate, migrateOrRollback, rakeDb, redo, removeMigratedVersion, resetDb, rollback, saveMigratedVersion, writeMigrationFile };
|