rake-db 2.4.1 → 2.4.3

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 CHANGED
@@ -1,13 +1,11 @@
1
- import * as pqb from 'pqb';
2
- import { ColumnType, EnumColumn, ColumnTypes, ColumnsShape, DbResult, DefaultColumnTypes, TransactionAdapter, AdapterOptions, TextColumn, IndexColumnOptions, IndexOptions, ForeignKeyOptions, QueryLogObject, NoPrimaryKeyOption, TableData, SingleColumnIndexOptions, QueryLogOptions } from 'pqb';
3
- import * as orchid_core from 'orchid-core';
4
- import { EmptyObject, RawExpression, raw, MaybeArray } from 'orchid-core';
1
+ import { ColumnType, EnumColumn, ColumnTypes, ColumnsShape, DbResult, DefaultColumnTypes, TransactionAdapter, QueryLogObject, IndexColumnOptions, IndexOptions, ForeignKeyOptions, TextColumn, NoPrimaryKeyOption, TableData, SingleColumnIndexOptions, AdapterOptions, QueryLogOptions } from 'pqb';
2
+ import { EmptyObject, RawExpression, ColumnTypesBase, raw, MaybeArray } from 'orchid-core';
5
3
 
6
- declare function add(item: ColumnType, options?: {
4
+ declare function add(this: ColumnTypesBase, item: ColumnType, options?: {
7
5
  dropMode?: DropMode;
8
6
  }): RakeDbAst.ChangeTableItem.Column;
9
- declare function add(emptyObject: EmptyObject): EmptyObject;
10
- declare function add(items: Record<string, ColumnType>, options?: {
7
+ declare function add(this: ColumnTypesBase, emptyObject: EmptyObject): EmptyObject;
8
+ declare function add(this: ColumnTypesBase, items: Record<string, ColumnType>, options?: {
11
9
  dropMode?: DropMode;
12
10
  }): Record<string, RakeDbAst.ChangeTableItem.Column>;
13
11
  declare type Change = RakeDbAst.ChangeTableItem.Change & ChangeOptions;
@@ -19,13 +17,13 @@ declare type TableChangeMethods = typeof tableChangeMethods;
19
17
  declare const tableChangeMethods: {
20
18
  add: typeof add;
21
19
  drop: typeof add;
22
- change(from: ColumnType | Change, to: ColumnType | Change, options?: ChangeOptions): Change;
20
+ change(this: ColumnTypesBase, from: ColumnType | Change, to: ColumnType | Change, options?: ChangeOptions): Change;
23
21
  default(value: unknown | RawExpression): Change;
24
22
  nullable(): Change;
25
23
  nonNullable(): Change;
26
24
  comment(comment: string | null): Change;
27
25
  rename(name: string): RakeDbAst.ChangeTableItem.Rename;
28
- enum(this: orchid_core.ColumnTypesBase, name: string): EnumColumn<string, [string, ...string[]]>;
26
+ enum(this: ColumnTypesBase, name: string): EnumColumn<string, [string, ...string[]]>;
29
27
  };
30
28
  declare type TableChanger = MigrationColumnTypes & TableChangeMethods;
31
29
  declare type TableChangeData = Record<string, RakeDbAst.ChangeTableItem.Column | RakeDbAst.ChangeTableItem.Rename | Change | EmptyObject>;
@@ -53,319 +51,14 @@ declare type ColumnComment = {
53
51
  column: string;
54
52
  comment: string | null;
55
53
  };
56
- declare type JoinTableOptions = {
57
- tableName?: string;
58
- comment?: string;
59
- dropMode?: DropMode;
60
- };
61
54
  declare type Migration = DbResult<DefaultColumnTypes> & MigrationBase;
62
- declare const createMigrationInterface: (tx: TransactionAdapter, up: boolean, options: RakeDbConfig, adapterOptions: AdapterOptions, appCodeUpdaterCache: object) => pqb.Db<string, Record<string, never>, pqb.RelationsBase, {
63
- name: typeof orchid_core.name;
64
- raw: (sql: string, values?: false | Record<string, unknown> | undefined) => orchid_core.RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>>;
65
- smallint(this: orchid_core.ColumnTypesBase): pqb.SmallIntColumn;
66
- integer(this: orchid_core.ColumnTypesBase): pqb.IntegerColumn;
67
- bigint(this: orchid_core.ColumnTypesBase): pqb.BigIntColumn;
68
- numeric<Precision extends number | undefined = undefined, Scale extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, precision?: Precision | undefined, scale?: Scale | undefined): pqb.DecimalColumn<Precision, Scale>;
69
- decimal<Precision_1 extends number | undefined = undefined, Scale_1 extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, precision?: Precision_1 | undefined, scale?: Scale_1 | undefined): pqb.DecimalColumn<Precision_1, Scale_1>;
70
- real(this: orchid_core.ColumnTypesBase): pqb.RealColumn;
71
- doublePrecision(this: orchid_core.ColumnTypesBase): pqb.DoublePrecisionColumn;
72
- smallSerial(this: orchid_core.ColumnTypesBase): pqb.SmallSerialColumn;
73
- serial(this: orchid_core.ColumnTypesBase): pqb.SerialColumn;
74
- bigSerial(this: orchid_core.ColumnTypesBase): pqb.BigSerialColumn;
75
- money(this: orchid_core.ColumnTypesBase): pqb.MoneyColumn;
76
- varchar<Limit extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, limit?: Limit | undefined): pqb.VarCharColumn<Limit>;
77
- char<Limit_1 extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, limit?: Limit_1 | undefined): pqb.CharColumn<Limit_1>;
78
- text: (this: orchid_core.ColumnTypesBase, min: number, max: number) => TextColumn;
79
- string: (this: orchid_core.ColumnTypesBase, min: number, max: number) => TextColumn;
80
- bytea(this: orchid_core.ColumnTypesBase): pqb.ByteaColumn;
81
- date(this: orchid_core.ColumnTypesBase): pqb.DateColumn;
82
- timestamp<Precision_2 extends number>(this: orchid_core.ColumnTypesBase, precision?: Precision_2 | undefined): pqb.TimestampColumn<Precision_2>;
83
- timestampWithTimeZone<Precision_3 extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, precision?: Precision_3 | undefined): pqb.TimestampWithTimeZoneColumn<number>;
84
- time<Precision_4 extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, precision?: Precision_4 | undefined): pqb.TimeColumn<Precision_4>;
85
- timeWithTimeZone<Precision_5 extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, precision?: Precision_5 | undefined): pqb.TimeWithTimeZoneColumn<Precision_5>;
86
- interval<Fields extends string | undefined = undefined, Precision_6 extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, fields?: Fields | undefined, precision?: Precision_6 | undefined): pqb.IntervalColumn<Fields, Precision_6>;
87
- boolean(this: orchid_core.ColumnTypesBase): pqb.BooleanColumn;
88
- enum<U extends string, T extends [U, ...U[]]>(this: orchid_core.ColumnTypesBase, dataType: string, type: T): EnumColumn<U, T>;
89
- point(this: orchid_core.ColumnTypesBase): pqb.PointColumn;
90
- line(this: orchid_core.ColumnTypesBase): pqb.LineColumn;
91
- lseg(this: orchid_core.ColumnTypesBase): pqb.LsegColumn;
92
- box(this: orchid_core.ColumnTypesBase): pqb.BoxColumn;
93
- path(this: orchid_core.ColumnTypesBase): pqb.PathColumn;
94
- polygon(this: orchid_core.ColumnTypesBase): pqb.PolygonColumn;
95
- circle(this: orchid_core.ColumnTypesBase): pqb.CircleColumn;
96
- cidr(this: orchid_core.ColumnTypesBase): pqb.CidrColumn;
97
- inet(this: orchid_core.ColumnTypesBase): pqb.InetColumn;
98
- macaddr(this: orchid_core.ColumnTypesBase): pqb.MacAddrColumn;
99
- macaddr8(this: orchid_core.ColumnTypesBase): pqb.MacAddr8Column;
100
- bit<Length extends number>(this: orchid_core.ColumnTypesBase, length: Length): pqb.BitColumn<Length>;
101
- bitVarying<Length_1 extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, length?: Length_1 | undefined): pqb.BitVaryingColumn<Length_1>;
102
- tsvector(this: orchid_core.ColumnTypesBase): pqb.TsVectorColumn;
103
- tsquery(this: orchid_core.ColumnTypesBase): pqb.TsQueryColumn;
104
- uuid(this: orchid_core.ColumnTypesBase): pqb.UUIDColumn;
105
- xml(this: orchid_core.ColumnTypesBase): pqb.XMLColumn;
106
- json<Type extends orchid_core.JSONTypeAny>(this: orchid_core.ColumnTypesBase, schemaOrFn: Type | ((j: {
107
- set: <Value extends orchid_core.JSONTypeAny>(valueType: Value) => orchid_core.JSONSet<Value>;
108
- tuple: <T_1 extends [] | orchid_core.JSONTupleItems, Rest extends orchid_core.JSONTypeAny | null = null>(items: T_1, rest?: Rest) => orchid_core.JSONTuple<T_1, Rest>;
109
- union: <T_2 extends [orchid_core.JSONTypeAny, orchid_core.JSONTypeAny, ...orchid_core.JSONTypeAny[]]>(types: T_2) => orchid_core.JSONUnion<T_2>;
110
- any: () => orchid_core.JSONAny;
111
- bigint: () => orchid_core.JSONBigInt;
112
- boolean: () => orchid_core.JSONBoolean;
113
- date: () => orchid_core.JSONDate;
114
- nan: () => orchid_core.JSONNaN;
115
- never: () => orchid_core.JSONNever;
116
- null: () => orchid_core.JSONNull;
117
- number: () => orchid_core.JSONNumber;
118
- string: () => orchid_core.JSONString;
119
- undefined: () => orchid_core.JSONUndefined;
120
- unknown: () => orchid_core.JSONUnknown;
121
- void: () => orchid_core.JSONVoid;
122
- array: <Type_1 extends orchid_core.JSONTypeAny>(element: Type_1) => orchid_core.JSONArray<Type_1, "many">;
123
- 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[number]>;
124
- enum: <U_1 extends string, T_3 extends [U_1, ...U_1[]]>(options: T_3) => orchid_core.JSONEnum<U_1, T_3>;
125
- instanceOf: <T_4 extends new (...args: any[]) => any>(cls: T_4) => orchid_core.JSONInstanceOf<T_4>;
126
- intersection: <Left extends orchid_core.JSONTypeAny, Right extends orchid_core.JSONTypeAny>(left: Left, right: Right) => orchid_core.JSONIntersection<Left, Right>;
127
- lazy: <T_5 extends orchid_core.JSONTypeAny>(fn: () => T_5) => orchid_core.JSONLazy<T_5>;
128
- literal: <T_6 extends orchid_core.Primitive>(value: T_6) => orchid_core.JSONLiteral<T_6>;
129
- map: <Key extends orchid_core.JSONTypeAny, Value_1 extends orchid_core.JSONTypeAny>(keyType: Key, valueType: Value_1) => orchid_core.JSONMap<Key, Value_1>;
130
- nativeEnum: <T_7 extends orchid_core.EnumLike>(givenEnum: T_7) => orchid_core.JSONNativeEnum<T_7>;
131
- nullable: <T_8 extends orchid_core.JSONTypeAny>(type: T_8) => orchid_core.JSONNullable<T_8>;
132
- nullish: <T_9 extends orchid_core.JSONTypeAny>(type: T_9) => orchid_core.JSONNullish<T_9>;
133
- object: <T_10 extends orchid_core.JSONObjectShape, UnknownKeys extends orchid_core.UnknownKeysParam = "strip", Catchall extends orchid_core.JSONTypeAny = orchid_core.JSONTypeAny>(shape: T_10) => orchid_core.JSONObject<T_10, UnknownKeys, Catchall, orchid_core.JSONTypeAny extends Catchall ? orchid_core.addQuestionMarks<{ [k_1 in keyof T_10]: T_10[k_1]["type"]; }> extends infer T_11 extends object ? { [k in keyof T_11]: orchid_core.addQuestionMarks<{ [k_1 in keyof T_10]: T_10[k_1]["type"]; }>[k]; } : never : (orchid_core.addQuestionMarks<{ [k_1 in keyof T_10]: T_10[k_1]["type"]; }> extends infer T_11 extends object ? { [k in keyof T_11]: orchid_core.addQuestionMarks<{ [k_1 in keyof T_10]: T_10[k_1]["type"]; }>[k]; } : never) & {
134
- [k: string]: Catchall["type"];
135
- } extends infer T_12 extends object ? { [k_2 in keyof T_12]: ((orchid_core.addQuestionMarks<{ [k_1 in keyof T_10]: T_10[k_1]["type"]; }> extends infer T_11 extends object ? { [k in keyof T_11]: orchid_core.addQuestionMarks<{ [k_1 in keyof T_10]: T_10[k_1]["type"]; }>[k]; } : never) & {
136
- [k: string]: Catchall["type"];
137
- })[k_2]; } : never>;
138
- optional: <T_13 extends orchid_core.JSONTypeAny>(type: T_13) => orchid_core.JSONOptional<T_13>;
139
- record: typeof orchid_core.record;
140
- }) => Type)): pqb.JSONColumn<Type>;
141
- jsonText(this: orchid_core.ColumnTypesBase): pqb.JSONTextColumn;
142
- array<Item extends ColumnType<unknown, orchid_core.BaseOperators, unknown>>(this: orchid_core.ColumnTypesBase, item: Item): pqb.ArrayColumn<Item>;
143
- timestamps: <T_14 extends ColumnType<unknown, orchid_core.BaseOperators, unknown>>(this: {
144
- timestamp(): T_14;
145
- }) => {
146
- createdAt: orchid_core.ColumnWithDefault<T_14, orchid_core.RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>>>;
147
- updatedAt: orchid_core.ColumnWithDefault<T_14, orchid_core.RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>>>;
148
- };
149
- primaryKey(columns: string[], options?: {
150
- name?: string | undefined;
151
- } | undefined): {};
152
- index(columns: MaybeArray<string | IndexColumnOptions>, options?: IndexOptions): {};
153
- unique(columns: MaybeArray<string | IndexColumnOptions>, options?: IndexOptions): {};
154
- foreignKey: {
155
- <Table extends pqb.ForeignKeyTableWithColumns, Columns extends [Exclude<keyof InstanceType<Table>["columns"]["shape"], number | symbol>, ...Exclude<keyof InstanceType<Table>["columns"]["shape"], number | symbol>[]]>(columns: string[], fn: () => Table, foreignColumns: Columns, options?: ForeignKeyOptions | undefined): {};
156
- <Table_1 extends string, Columns_1 extends [string, ...string[]]>(columns: string[], table: Table_1, foreignColumns: Columns_1, options?: ForeignKeyOptions | undefined): {};
157
- };
158
- }> & {
159
- <Table_2 extends string, Shape extends ColumnsShape = ColumnsShape>(table: Table_2, shape?: Shape | ((t: {
160
- name: typeof orchid_core.name;
161
- raw: (sql: string, values?: false | Record<string, unknown> | undefined) => orchid_core.RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>>;
162
- smallint(this: orchid_core.ColumnTypesBase): pqb.SmallIntColumn;
163
- integer(this: orchid_core.ColumnTypesBase): pqb.IntegerColumn;
164
- bigint(this: orchid_core.ColumnTypesBase): pqb.BigIntColumn;
165
- numeric<Precision extends number | undefined = undefined, Scale extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, precision?: Precision | undefined, scale?: Scale | undefined): pqb.DecimalColumn<Precision, Scale>;
166
- decimal<Precision_1 extends number | undefined = undefined, Scale_1 extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, precision?: Precision_1 | undefined, scale?: Scale_1 | undefined): pqb.DecimalColumn<Precision_1, Scale_1>;
167
- real(this: orchid_core.ColumnTypesBase): pqb.RealColumn;
168
- doublePrecision(this: orchid_core.ColumnTypesBase): pqb.DoublePrecisionColumn;
169
- smallSerial(this: orchid_core.ColumnTypesBase): pqb.SmallSerialColumn;
170
- serial(this: orchid_core.ColumnTypesBase): pqb.SerialColumn;
171
- bigSerial(this: orchid_core.ColumnTypesBase): pqb.BigSerialColumn;
172
- money(this: orchid_core.ColumnTypesBase): pqb.MoneyColumn;
173
- varchar<Limit extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, limit?: Limit | undefined): pqb.VarCharColumn<Limit>;
174
- char<Limit_1 extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, limit?: Limit_1 | undefined): pqb.CharColumn<Limit_1>;
175
- text: (this: orchid_core.ColumnTypesBase, min: number, max: number) => TextColumn;
176
- string: (this: orchid_core.ColumnTypesBase, min: number, max: number) => TextColumn;
177
- bytea(this: orchid_core.ColumnTypesBase): pqb.ByteaColumn;
178
- date(this: orchid_core.ColumnTypesBase): pqb.DateColumn;
179
- timestamp<Precision_2 extends number>(this: orchid_core.ColumnTypesBase, precision?: Precision_2 | undefined): pqb.TimestampColumn<Precision_2>;
180
- timestampWithTimeZone<Precision_3 extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, precision?: Precision_3 | undefined): pqb.TimestampWithTimeZoneColumn<number>;
181
- time<Precision_4 extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, precision?: Precision_4 | undefined): pqb.TimeColumn<Precision_4>;
182
- timeWithTimeZone<Precision_5 extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, precision?: Precision_5 | undefined): pqb.TimeWithTimeZoneColumn<Precision_5>;
183
- interval<Fields extends string | undefined = undefined, Precision_6 extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, fields?: Fields | undefined, precision?: Precision_6 | undefined): pqb.IntervalColumn<Fields, Precision_6>;
184
- boolean(this: orchid_core.ColumnTypesBase): pqb.BooleanColumn;
185
- enum<U extends string, T extends [U, ...U[]]>(this: orchid_core.ColumnTypesBase, dataType: string, type: T): EnumColumn<U, T>;
186
- point(this: orchid_core.ColumnTypesBase): pqb.PointColumn;
187
- line(this: orchid_core.ColumnTypesBase): pqb.LineColumn;
188
- lseg(this: orchid_core.ColumnTypesBase): pqb.LsegColumn;
189
- box(this: orchid_core.ColumnTypesBase): pqb.BoxColumn;
190
- path(this: orchid_core.ColumnTypesBase): pqb.PathColumn;
191
- polygon(this: orchid_core.ColumnTypesBase): pqb.PolygonColumn;
192
- circle(this: orchid_core.ColumnTypesBase): pqb.CircleColumn;
193
- cidr(this: orchid_core.ColumnTypesBase): pqb.CidrColumn;
194
- inet(this: orchid_core.ColumnTypesBase): pqb.InetColumn;
195
- macaddr(this: orchid_core.ColumnTypesBase): pqb.MacAddrColumn;
196
- macaddr8(this: orchid_core.ColumnTypesBase): pqb.MacAddr8Column;
197
- bit<Length extends number>(this: orchid_core.ColumnTypesBase, length: Length): pqb.BitColumn<Length>;
198
- bitVarying<Length_1 extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, length?: Length_1 | undefined): pqb.BitVaryingColumn<Length_1>;
199
- tsvector(this: orchid_core.ColumnTypesBase): pqb.TsVectorColumn;
200
- tsquery(this: orchid_core.ColumnTypesBase): pqb.TsQueryColumn;
201
- uuid(this: orchid_core.ColumnTypesBase): pqb.UUIDColumn;
202
- xml(this: orchid_core.ColumnTypesBase): pqb.XMLColumn;
203
- json<Type extends orchid_core.JSONTypeAny>(this: orchid_core.ColumnTypesBase, schemaOrFn: Type | ((j: {
204
- set: <Value extends orchid_core.JSONTypeAny>(valueType: Value) => orchid_core.JSONSet<Value>;
205
- tuple: <T_1 extends [] | orchid_core.JSONTupleItems, Rest extends orchid_core.JSONTypeAny | null = null>(items: T_1, rest?: Rest) => orchid_core.JSONTuple<T_1, Rest>;
206
- union: <T_2 extends [orchid_core.JSONTypeAny, orchid_core.JSONTypeAny, ...orchid_core.JSONTypeAny[]]>(types: T_2) => orchid_core.JSONUnion<T_2>;
207
- any: () => orchid_core.JSONAny;
208
- bigint: () => orchid_core.JSONBigInt;
209
- boolean: () => orchid_core.JSONBoolean;
210
- date: () => orchid_core.JSONDate;
211
- nan: () => orchid_core.JSONNaN;
212
- never: () => orchid_core.JSONNever;
213
- null: () => orchid_core.JSONNull;
214
- number: () => orchid_core.JSONNumber;
215
- string: () => orchid_core.JSONString;
216
- undefined: () => orchid_core.JSONUndefined;
217
- unknown: () => orchid_core.JSONUnknown;
218
- void: () => orchid_core.JSONVoid;
219
- array: <Type_1 extends orchid_core.JSONTypeAny>(element: Type_1) => orchid_core.JSONArray<Type_1, "many">;
220
- 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[number]>;
221
- enum: <U_1 extends string, T_3 extends [U_1, ...U_1[]]>(options: T_3) => orchid_core.JSONEnum<U_1, T_3>;
222
- instanceOf: <T_4 extends new (...args: any[]) => any>(cls: T_4) => orchid_core.JSONInstanceOf<T_4>;
223
- intersection: <Left extends orchid_core.JSONTypeAny, Right extends orchid_core.JSONTypeAny>(left: Left, right: Right) => orchid_core.JSONIntersection<Left, Right>;
224
- lazy: <T_5 extends orchid_core.JSONTypeAny>(fn: () => T_5) => orchid_core.JSONLazy<T_5>;
225
- literal: <T_6 extends orchid_core.Primitive>(value: T_6) => orchid_core.JSONLiteral<T_6>;
226
- map: <Key extends orchid_core.JSONTypeAny, Value_1 extends orchid_core.JSONTypeAny>(keyType: Key, valueType: Value_1) => orchid_core.JSONMap<Key, Value_1>;
227
- nativeEnum: <T_7 extends orchid_core.EnumLike>(givenEnum: T_7) => orchid_core.JSONNativeEnum<T_7>;
228
- nullable: <T_8 extends orchid_core.JSONTypeAny>(type: T_8) => orchid_core.JSONNullable<T_8>;
229
- nullish: <T_9 extends orchid_core.JSONTypeAny>(type: T_9) => orchid_core.JSONNullish<T_9>;
230
- object: <T_10 extends orchid_core.JSONObjectShape, UnknownKeys extends orchid_core.UnknownKeysParam = "strip", Catchall extends orchid_core.JSONTypeAny = orchid_core.JSONTypeAny>(shape: T_10) => orchid_core.JSONObject<T_10, UnknownKeys, Catchall, orchid_core.JSONTypeAny extends Catchall ? orchid_core.addQuestionMarks<{ [k_1 in keyof T_10]: T_10[k_1]["type"]; }> extends infer T_11 extends object ? { [k in keyof T_11]: orchid_core.addQuestionMarks<{ [k_1 in keyof T_10]: T_10[k_1]["type"]; }>[k]; } : never : (orchid_core.addQuestionMarks<{ [k_1 in keyof T_10]: T_10[k_1]["type"]; }> extends infer T_11 extends object ? { [k in keyof T_11]: orchid_core.addQuestionMarks<{ [k_1 in keyof T_10]: T_10[k_1]["type"]; }>[k]; } : never) & {
231
- [k: string]: Catchall["type"];
232
- } extends infer T_12 extends object ? { [k_2 in keyof T_12]: ((orchid_core.addQuestionMarks<{ [k_1 in keyof T_10]: T_10[k_1]["type"]; }> extends infer T_11 extends object ? { [k in keyof T_11]: orchid_core.addQuestionMarks<{ [k_1 in keyof T_10]: T_10[k_1]["type"]; }>[k]; } : never) & {
233
- [k: string]: Catchall["type"];
234
- })[k_2]; } : never>;
235
- optional: <T_13 extends orchid_core.JSONTypeAny>(type: T_13) => orchid_core.JSONOptional<T_13>;
236
- record: typeof orchid_core.record;
237
- }) => Type)): pqb.JSONColumn<Type>;
238
- jsonText(this: orchid_core.ColumnTypesBase): pqb.JSONTextColumn;
239
- array<Item extends ColumnType<unknown, orchid_core.BaseOperators, unknown>>(this: orchid_core.ColumnTypesBase, item: Item): pqb.ArrayColumn<Item>;
240
- timestamps: <T_14 extends ColumnType<unknown, orchid_core.BaseOperators, unknown>>(this: {
241
- timestamp(): T_14;
242
- }) => {
243
- createdAt: orchid_core.ColumnWithDefault<T_14, orchid_core.RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>>>;
244
- updatedAt: orchid_core.ColumnWithDefault<T_14, orchid_core.RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>>>;
245
- };
246
- primaryKey(columns: string[], options?: {
247
- name?: string | undefined;
248
- } | undefined): {};
249
- index(columns: MaybeArray<string | IndexColumnOptions>, options?: IndexOptions): {};
250
- unique(columns: MaybeArray<string | IndexColumnOptions>, options?: IndexOptions): {};
251
- foreignKey: {
252
- <Table extends pqb.ForeignKeyTableWithColumns, Columns extends [Exclude<keyof InstanceType<Table>["columns"]["shape"], number | symbol>, ...Exclude<keyof InstanceType<Table>["columns"]["shape"], number | symbol>[]]>(columns: string[], fn: () => Table, foreignColumns: Columns, options?: ForeignKeyOptions | undefined): {};
253
- <Table_1 extends string, Columns_1 extends [string, ...string[]]>(columns: string[], table: Table_1, foreignColumns: Columns_1, options?: ForeignKeyOptions | undefined): {};
254
- };
255
- }) => Shape) | undefined, options?: pqb.DbTableOptions | undefined): pqb.Db<Table_2, Shape, pqb.RelationsBase, {
256
- name: typeof orchid_core.name;
257
- raw: (sql: string, values?: false | Record<string, unknown> | undefined) => orchid_core.RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>>;
258
- smallint(this: orchid_core.ColumnTypesBase): pqb.SmallIntColumn;
259
- integer(this: orchid_core.ColumnTypesBase): pqb.IntegerColumn;
260
- bigint(this: orchid_core.ColumnTypesBase): pqb.BigIntColumn;
261
- numeric<Precision extends number | undefined = undefined, Scale extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, precision?: Precision | undefined, scale?: Scale | undefined): pqb.DecimalColumn<Precision, Scale>;
262
- decimal<Precision_1 extends number | undefined = undefined, Scale_1 extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, precision?: Precision_1 | undefined, scale?: Scale_1 | undefined): pqb.DecimalColumn<Precision_1, Scale_1>;
263
- real(this: orchid_core.ColumnTypesBase): pqb.RealColumn;
264
- doublePrecision(this: orchid_core.ColumnTypesBase): pqb.DoublePrecisionColumn;
265
- smallSerial(this: orchid_core.ColumnTypesBase): pqb.SmallSerialColumn;
266
- serial(this: orchid_core.ColumnTypesBase): pqb.SerialColumn;
267
- bigSerial(this: orchid_core.ColumnTypesBase): pqb.BigSerialColumn;
268
- money(this: orchid_core.ColumnTypesBase): pqb.MoneyColumn;
269
- varchar<Limit extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, limit?: Limit | undefined): pqb.VarCharColumn<Limit>;
270
- char<Limit_1 extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, limit?: Limit_1 | undefined): pqb.CharColumn<Limit_1>;
271
- text: (this: orchid_core.ColumnTypesBase, min: number, max: number) => TextColumn;
272
- string: (this: orchid_core.ColumnTypesBase, min: number, max: number) => TextColumn;
273
- bytea(this: orchid_core.ColumnTypesBase): pqb.ByteaColumn;
274
- date(this: orchid_core.ColumnTypesBase): pqb.DateColumn;
275
- timestamp<Precision_2 extends number>(this: orchid_core.ColumnTypesBase, precision?: Precision_2 | undefined): pqb.TimestampColumn<Precision_2>;
276
- timestampWithTimeZone<Precision_3 extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, precision?: Precision_3 | undefined): pqb.TimestampWithTimeZoneColumn<number>;
277
- time<Precision_4 extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, precision?: Precision_4 | undefined): pqb.TimeColumn<Precision_4>;
278
- timeWithTimeZone<Precision_5 extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, precision?: Precision_5 | undefined): pqb.TimeWithTimeZoneColumn<Precision_5>;
279
- interval<Fields extends string | undefined = undefined, Precision_6 extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, fields?: Fields | undefined, precision?: Precision_6 | undefined): pqb.IntervalColumn<Fields, Precision_6>;
280
- boolean(this: orchid_core.ColumnTypesBase): pqb.BooleanColumn;
281
- enum<U extends string, T extends [U, ...U[]]>(this: orchid_core.ColumnTypesBase, dataType: string, type: T): EnumColumn<U, T>;
282
- point(this: orchid_core.ColumnTypesBase): pqb.PointColumn;
283
- line(this: orchid_core.ColumnTypesBase): pqb.LineColumn;
284
- lseg(this: orchid_core.ColumnTypesBase): pqb.LsegColumn;
285
- box(this: orchid_core.ColumnTypesBase): pqb.BoxColumn;
286
- path(this: orchid_core.ColumnTypesBase): pqb.PathColumn;
287
- polygon(this: orchid_core.ColumnTypesBase): pqb.PolygonColumn;
288
- circle(this: orchid_core.ColumnTypesBase): pqb.CircleColumn;
289
- cidr(this: orchid_core.ColumnTypesBase): pqb.CidrColumn;
290
- inet(this: orchid_core.ColumnTypesBase): pqb.InetColumn;
291
- macaddr(this: orchid_core.ColumnTypesBase): pqb.MacAddrColumn;
292
- macaddr8(this: orchid_core.ColumnTypesBase): pqb.MacAddr8Column;
293
- bit<Length extends number>(this: orchid_core.ColumnTypesBase, length: Length): pqb.BitColumn<Length>;
294
- bitVarying<Length_1 extends number | undefined = undefined>(this: orchid_core.ColumnTypesBase, length?: Length_1 | undefined): pqb.BitVaryingColumn<Length_1>;
295
- tsvector(this: orchid_core.ColumnTypesBase): pqb.TsVectorColumn;
296
- tsquery(this: orchid_core.ColumnTypesBase): pqb.TsQueryColumn;
297
- uuid(this: orchid_core.ColumnTypesBase): pqb.UUIDColumn;
298
- xml(this: orchid_core.ColumnTypesBase): pqb.XMLColumn;
299
- json<Type extends orchid_core.JSONTypeAny>(this: orchid_core.ColumnTypesBase, schemaOrFn: Type | ((j: {
300
- set: <Value extends orchid_core.JSONTypeAny>(valueType: Value) => orchid_core.JSONSet<Value>;
301
- tuple: <T_1 extends [] | orchid_core.JSONTupleItems, Rest extends orchid_core.JSONTypeAny | null = null>(items: T_1, rest?: Rest) => orchid_core.JSONTuple<T_1, Rest>;
302
- union: <T_2 extends [orchid_core.JSONTypeAny, orchid_core.JSONTypeAny, ...orchid_core.JSONTypeAny[]]>(types: T_2) => orchid_core.JSONUnion<T_2>;
303
- any: () => orchid_core.JSONAny;
304
- bigint: () => orchid_core.JSONBigInt;
305
- boolean: () => orchid_core.JSONBoolean;
306
- date: () => orchid_core.JSONDate;
307
- nan: () => orchid_core.JSONNaN;
308
- never: () => orchid_core.JSONNever;
309
- null: () => orchid_core.JSONNull;
310
- number: () => orchid_core.JSONNumber;
311
- string: () => orchid_core.JSONString;
312
- undefined: () => orchid_core.JSONUndefined;
313
- unknown: () => orchid_core.JSONUnknown;
314
- void: () => orchid_core.JSONVoid;
315
- array: <Type_1 extends orchid_core.JSONTypeAny>(element: Type_1) => orchid_core.JSONArray<Type_1, "many">;
316
- 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[number]>;
317
- enum: <U_1 extends string, T_3 extends [U_1, ...U_1[]]>(options: T_3) => orchid_core.JSONEnum<U_1, T_3>;
318
- instanceOf: <T_4 extends new (...args: any[]) => any>(cls: T_4) => orchid_core.JSONInstanceOf<T_4>;
319
- intersection: <Left extends orchid_core.JSONTypeAny, Right extends orchid_core.JSONTypeAny>(left: Left, right: Right) => orchid_core.JSONIntersection<Left, Right>;
320
- lazy: <T_5 extends orchid_core.JSONTypeAny>(fn: () => T_5) => orchid_core.JSONLazy<T_5>;
321
- literal: <T_6 extends orchid_core.Primitive>(value: T_6) => orchid_core.JSONLiteral<T_6>;
322
- map: <Key extends orchid_core.JSONTypeAny, Value_1 extends orchid_core.JSONTypeAny>(keyType: Key, valueType: Value_1) => orchid_core.JSONMap<Key, Value_1>;
323
- nativeEnum: <T_7 extends orchid_core.EnumLike>(givenEnum: T_7) => orchid_core.JSONNativeEnum<T_7>;
324
- nullable: <T_8 extends orchid_core.JSONTypeAny>(type: T_8) => orchid_core.JSONNullable<T_8>;
325
- nullish: <T_9 extends orchid_core.JSONTypeAny>(type: T_9) => orchid_core.JSONNullish<T_9>;
326
- object: <T_10 extends orchid_core.JSONObjectShape, UnknownKeys extends orchid_core.UnknownKeysParam = "strip", Catchall extends orchid_core.JSONTypeAny = orchid_core.JSONTypeAny>(shape: T_10) => orchid_core.JSONObject<T_10, UnknownKeys, Catchall, orchid_core.JSONTypeAny extends Catchall ? orchid_core.addQuestionMarks<{ [k_1 in keyof T_10]: T_10[k_1]["type"]; }> extends infer T_11 extends object ? { [k in keyof T_11]: orchid_core.addQuestionMarks<{ [k_1 in keyof T_10]: T_10[k_1]["type"]; }>[k]; } : never : (orchid_core.addQuestionMarks<{ [k_1 in keyof T_10]: T_10[k_1]["type"]; }> extends infer T_11 extends object ? { [k in keyof T_11]: orchid_core.addQuestionMarks<{ [k_1 in keyof T_10]: T_10[k_1]["type"]; }>[k]; } : never) & {
327
- [k: string]: Catchall["type"];
328
- } extends infer T_12 extends object ? { [k_2 in keyof T_12]: ((orchid_core.addQuestionMarks<{ [k_1 in keyof T_10]: T_10[k_1]["type"]; }> extends infer T_11 extends object ? { [k in keyof T_11]: orchid_core.addQuestionMarks<{ [k_1 in keyof T_10]: T_10[k_1]["type"]; }>[k]; } : never) & {
329
- [k: string]: Catchall["type"];
330
- })[k_2]; } : never>;
331
- optional: <T_13 extends orchid_core.JSONTypeAny>(type: T_13) => orchid_core.JSONOptional<T_13>;
332
- record: typeof orchid_core.record;
333
- }) => Type)): pqb.JSONColumn<Type>;
334
- jsonText(this: orchid_core.ColumnTypesBase): pqb.JSONTextColumn;
335
- array<Item extends ColumnType<unknown, orchid_core.BaseOperators, unknown>>(this: orchid_core.ColumnTypesBase, item: Item): pqb.ArrayColumn<Item>;
336
- timestamps: <T_14 extends ColumnType<unknown, orchid_core.BaseOperators, unknown>>(this: {
337
- timestamp(): T_14;
338
- }) => {
339
- createdAt: orchid_core.ColumnWithDefault<T_14, orchid_core.RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>>>;
340
- updatedAt: orchid_core.ColumnWithDefault<T_14, orchid_core.RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>>>;
341
- };
342
- primaryKey(columns: string[], options?: {
343
- name?: string | undefined;
344
- } | undefined): {};
345
- index(columns: MaybeArray<string | IndexColumnOptions>, options?: IndexOptions): {};
346
- unique(columns: MaybeArray<string | IndexColumnOptions>, options?: IndexOptions): {};
347
- foreignKey: {
348
- <Table extends pqb.ForeignKeyTableWithColumns, Columns extends [Exclude<keyof InstanceType<Table>["columns"]["shape"], number | symbol>, ...Exclude<keyof InstanceType<Table>["columns"]["shape"], number | symbol>[]]>(columns: string[], fn: () => Table, foreignColumns: Columns, options?: ForeignKeyOptions | undefined): {};
349
- <Table_1 extends string, Columns_1 extends [string, ...string[]]>(columns: string[], table: Table_1, foreignColumns: Columns_1, options?: ForeignKeyOptions | undefined): {};
350
- };
351
- }>;
352
- adapter: pqb.Adapter;
353
- close: () => Promise<void>;
354
- } & MigrationBase & {
355
- adapter: TransactionAdapter;
356
- log: QueryLogObject | undefined;
357
- up: boolean;
358
- options: RakeDbConfig;
359
- adapterOptions: AdapterOptions;
360
- appCodeUpdaterCache: object;
361
- };
55
+ declare const createMigrationInterface: (tx: TransactionAdapter, up: boolean, options: RakeDbConfig) => Migration;
362
56
  declare class MigrationBase {
363
57
  adapter: TransactionAdapter;
364
58
  log?: QueryLogObject;
365
59
  up: boolean;
366
60
  options: RakeDbConfig;
367
- adapterOptions: AdapterOptions;
368
- appCodeUpdaterCache: object;
61
+ migratedAsts: RakeDbAst[];
369
62
  createTable(tableName: string, options: TableOptions, fn: ColumnsShapeCallback): Promise<void>;
370
63
  createTable(tableName: string, fn: ColumnsShapeCallback): Promise<void>;
371
64
  dropTable(tableName: string, options: TableOptions, fn: ColumnsShapeCallback): Promise<void>;
@@ -390,13 +83,12 @@ declare class MigrationBase {
390
83
  dropSchema(schemaName: string): Promise<void>;
391
84
  createExtension(name: string, options?: Omit<RakeDbAst.Extension, 'type' | 'action' | 'name'>): Promise<void>;
392
85
  dropExtension(name: string, options?: Omit<RakeDbAst.Extension, 'type' | 'action' | 'name' | 'values'>): Promise<void>;
393
- createEnum(name: string, values: string[], options?: Omit<RakeDbAst.Enum, 'type' | 'action' | 'name' | 'values'>): Promise<void>;
394
- dropEnum(name: string, values: string[], options?: Omit<RakeDbAst.Enum, 'type' | 'action' | 'name' | 'values'>): Promise<void>;
86
+ createEnum(name: string, values: [string, ...string[]], options?: Omit<RakeDbAst.Enum, 'type' | 'action' | 'name' | 'values'>): Promise<void>;
87
+ dropEnum(name: string, values: [string, ...string[]], options?: Omit<RakeDbAst.Enum, 'type' | 'action' | 'name' | 'values'>): Promise<void>;
395
88
  tableExists(tableName: string): Promise<boolean>;
396
89
  columnExists(tableName: string, columnName: string): Promise<boolean>;
397
90
  constraintExists(constraintName: string): Promise<boolean>;
398
91
  }
399
- declare const runCodeUpdater: (migration: MigrationBase, ast: RakeDbAst) => Promise<void> | undefined;
400
92
 
401
93
  declare type RakeDbAst = RakeDbAst.Table | RakeDbAst.ChangeTable | RakeDbAst.RenameTable | RakeDbAst.Schema | RakeDbAst.Extension | RakeDbAst.Enum | RakeDbAst.ForeignKey;
402
94
  declare namespace RakeDbAst {
@@ -428,6 +120,7 @@ declare namespace RakeDbAst {
428
120
  };
429
121
  type Change = {
430
122
  type: 'change';
123
+ name?: string;
431
124
  from: ColumnChange;
432
125
  to: ColumnChange;
433
126
  using?: RawExpression;
@@ -479,7 +172,7 @@ declare namespace RakeDbAst {
479
172
  action: 'create' | 'drop';
480
173
  schema?: string;
481
174
  name: string;
482
- values: string[];
175
+ values: [string, ...string[]];
483
176
  cascade?: boolean;
484
177
  dropIfExists?: boolean;
485
178
  };
@@ -500,6 +193,7 @@ declare type RakeDbConfig = {
500
193
  basePath: string;
501
194
  migrationsPath: string;
502
195
  migrationsTable: string;
196
+ snakeCase: boolean;
503
197
  commands: Record<string, (options: AdapterOptions[], config: RakeDbConfig, args: string[]) => Promise<void>>;
504
198
  import(path: string): Promise<void>;
505
199
  noPrimaryKey?: NoPrimaryKeyOption;
@@ -515,6 +209,7 @@ declare type AppCodeUpdater = (params: {
515
209
  options: AdapterOptions;
516
210
  basePath: string;
517
211
  cache: object;
212
+ logger: QueryLogOptions['logger'];
518
213
  }) => Promise<void>;
519
214
 
520
215
  declare const createDb: (arg: MaybeArray<AdapterOptions>, config: RakeDbConfig) => Promise<void>;
@@ -534,4 +229,4 @@ declare const rollback: (options: MaybeArray<AdapterOptions>, config: RakeDbConf
534
229
 
535
230
  declare const rakeDb: (options: MaybeArray<AdapterOptions>, partialConfig?: Partial<RakeDbConfig>, args?: string[]) => Promise<void>;
536
231
 
537
- export { AppCodeUpdater, ChangeTableCallback, ChangeTableOptions, ColumnComment, ColumnsShapeCallback, DropMode, JoinTableOptions, Migration, MigrationBase, MigrationColumnTypes, RakeDbAst, RakeDbConfig, TableOptions, change, changeCache, createDb, createMigrationInterface, dropDb, generate, migrate, migrateOrRollback, rakeDb, resetDb, rollback, runCodeUpdater, writeMigrationFile };
232
+ export { AppCodeUpdater, ChangeTableCallback, ChangeTableOptions, ColumnComment, ColumnsShapeCallback, DropMode, Migration, MigrationBase, MigrationColumnTypes, RakeDbAst, RakeDbConfig, TableOptions, change, changeCache, createDb, createMigrationInterface, dropDb, generate, migrate, migrateOrRollback, rakeDb, resetDb, rollback, writeMigrationFile };