@immich/sql-tools 0.1.1 → 0.2.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 +55 -5
- package/dist/index.js +3015 -32
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ColumnType as ColumnType_2 } from 'kysely';
|
|
2
|
+
import { default as default_2 } from 'postgres';
|
|
2
3
|
import { Kysely } from 'kysely';
|
|
3
|
-
import {
|
|
4
|
+
import { Notice } from 'postgres';
|
|
5
|
+
import { SSLConfig } from 'pg-connection-string';
|
|
4
6
|
|
|
5
7
|
export declare enum ActionType {
|
|
6
8
|
NO_ACTION = "NO ACTION",
|
|
@@ -16,6 +18,15 @@ export declare const AfterInsertTrigger: (options: Omit<TriggerFunctionOptions,
|
|
|
16
18
|
|
|
17
19
|
export declare const asHuman: (item: SchemaDiff) => string;
|
|
18
20
|
|
|
21
|
+
export declare const asPostgresConfig: (params: DatabaseConnectionParams) => {
|
|
22
|
+
host: string | undefined;
|
|
23
|
+
port: number | undefined;
|
|
24
|
+
username: string | undefined;
|
|
25
|
+
password: string | undefined;
|
|
26
|
+
database: string | undefined;
|
|
27
|
+
ssl: PostgresSsl | undefined;
|
|
28
|
+
};
|
|
29
|
+
|
|
19
30
|
export declare const asSql: (item: SchemaDiff, options: SchemaDiffToSqlOptions) => string[];
|
|
20
31
|
|
|
21
32
|
declare class BaseContext {
|
|
@@ -130,6 +141,8 @@ export declare enum ConstraintType {
|
|
|
130
141
|
|
|
131
142
|
export declare const CreateDateColumn: (options?: ColumnOptions) => PropertyDecorator;
|
|
132
143
|
|
|
144
|
+
export declare const createPostgres: (options?: DatabasePostgresOptions) => default_2.Sql<{}>;
|
|
145
|
+
|
|
133
146
|
export declare const Database: (options: DatabaseOptions) => ClassDecorator;
|
|
134
147
|
|
|
135
148
|
export declare type DatabaseCheckConstraint = {
|
|
@@ -160,6 +173,23 @@ export declare type DatabaseColumn = {
|
|
|
160
173
|
numericScale?: number;
|
|
161
174
|
};
|
|
162
175
|
|
|
176
|
+
export declare type DatabaseConnectionParams = DatabaseConnectionURL | DatabaseConnectionParts;
|
|
177
|
+
|
|
178
|
+
export declare type DatabaseConnectionParts = {
|
|
179
|
+
connectionType: 'parts';
|
|
180
|
+
host: string;
|
|
181
|
+
port: number;
|
|
182
|
+
username: string;
|
|
183
|
+
password: string;
|
|
184
|
+
database: string;
|
|
185
|
+
ssl?: DatabaseSslMode;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export declare type DatabaseConnectionURL = {
|
|
189
|
+
connectionType: 'url';
|
|
190
|
+
url: string;
|
|
191
|
+
};
|
|
192
|
+
|
|
163
193
|
export declare type DatabaseConstraint = DatabasePrimaryKeyConstraint | DatabaseForeignKeyConstraint | DatabaseUniqueConstraint | DatabaseCheckConstraint;
|
|
164
194
|
|
|
165
195
|
export declare type DatabaseEnum = {
|
|
@@ -202,8 +232,6 @@ export declare type DatabaseIndex = {
|
|
|
202
232
|
synchronize: boolean;
|
|
203
233
|
};
|
|
204
234
|
|
|
205
|
-
export declare type DatabaseLike = Sql | Kysely<unknown>;
|
|
206
|
-
|
|
207
235
|
export declare type DatabaseOptions = {
|
|
208
236
|
name?: string;
|
|
209
237
|
synchronize?: boolean;
|
|
@@ -227,6 +255,16 @@ export declare type DatabaseParameter = {
|
|
|
227
255
|
synchronize: boolean;
|
|
228
256
|
};
|
|
229
257
|
|
|
258
|
+
export declare type DatabasePostgresOptions = {
|
|
259
|
+
connection?: DatabaseConnectionParams;
|
|
260
|
+
maxConnections?: number;
|
|
261
|
+
timeZone?: string;
|
|
262
|
+
convertToJsDate?: boolean;
|
|
263
|
+
convertBigIntToNumber?: boolean;
|
|
264
|
+
onNotice?: (notice: Notice) => void;
|
|
265
|
+
onClose?: (connectionId: number) => void;
|
|
266
|
+
};
|
|
267
|
+
|
|
230
268
|
export declare type DatabasePrimaryKeyConstraint = ColumBasedConstraint & {
|
|
231
269
|
type: ConstraintType.PRIMARY_KEY;
|
|
232
270
|
synchronize: boolean;
|
|
@@ -244,6 +282,14 @@ export declare type DatabaseSchema = {
|
|
|
244
282
|
warnings: string[];
|
|
245
283
|
};
|
|
246
284
|
|
|
285
|
+
export declare enum DatabaseSslMode {
|
|
286
|
+
Disable = "disable",
|
|
287
|
+
Allow = "allow",
|
|
288
|
+
Prefer = "prefer",
|
|
289
|
+
Require = "require",
|
|
290
|
+
VerifyFull = "verify-full"
|
|
291
|
+
}
|
|
292
|
+
|
|
247
293
|
export declare type DatabaseTable = {
|
|
248
294
|
name: string;
|
|
249
295
|
columns: DatabaseColumn[];
|
|
@@ -371,6 +417,8 @@ export declare type IndexOptions = {
|
|
|
371
417
|
|
|
372
418
|
export declare type Int8 = ColumnType_2<number>;
|
|
373
419
|
|
|
420
|
+
export declare const isPostgresSsl: (ssl?: string | boolean | object) => ssl is PostgresSsl;
|
|
421
|
+
|
|
374
422
|
export declare interface NamingInterface {
|
|
375
423
|
getName(item: NamingItem): string;
|
|
376
424
|
}
|
|
@@ -639,6 +687,8 @@ export declare type PostgresDB = {
|
|
|
639
687
|
};
|
|
640
688
|
};
|
|
641
689
|
|
|
690
|
+
export declare type PostgresSsl = 'require' | 'allow' | 'prefer' | 'verify-full' | boolean | SSLConfig;
|
|
691
|
+
|
|
642
692
|
declare type PostgresYesOrNo = 'YES' | 'NO';
|
|
643
693
|
|
|
644
694
|
export declare const PrimaryColumn: (options?: Omit<ColumnOptions, "primary">) => PropertyDecorator;
|
|
@@ -895,9 +945,9 @@ export declare type SchemaFromCodeOptions = BaseContextOptions & {
|
|
|
895
945
|
/**
|
|
896
946
|
* Load schema from a database url
|
|
897
947
|
*/
|
|
898
|
-
export declare const schemaFromDatabase: (
|
|
948
|
+
export declare const schemaFromDatabase: (options?: SchemaFromDatabaseOptions) => Promise<DatabaseSchema>;
|
|
899
949
|
|
|
900
|
-
export declare type SchemaFromDatabaseOptions = BaseContextOptions;
|
|
950
|
+
export declare type SchemaFromDatabaseOptions = BaseContextOptions & DatabasePostgresOptions;
|
|
901
951
|
|
|
902
952
|
/** Table comments here */
|
|
903
953
|
export declare const Table: (options?: string | TableOptions) => ClassDecorator;
|