@carno.js/cli 0.3.0 → 0.3.4

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.
@@ -1,116 +0,0 @@
1
- import { ConnectionSettings, Orm } from '@carno.js/orm';
2
- import { EntityStorage } from '@carno.js/orm';
3
- import * as knex from 'knex';
4
- export type SnapshotTable = {
5
- tableName: string;
6
- schema?: string;
7
- columns: ColumnsInfo[];
8
- indexes: SnapshotIndexInfo[];
9
- uniques?: SnapshotUniqueInfo[];
10
- foreignKeys?: ForeignKeyInfo[];
11
- };
12
- export type SnapshotIndexInfo = {
13
- table: string;
14
- indexName: string;
15
- columnName: string;
16
- where?: string;
17
- };
18
- export type SnapshotUniqueInfo = {
19
- table: string;
20
- uniqueName: string;
21
- columnName: string;
22
- };
23
- export type ForeignKeyInfo = {
24
- referencedTableName: string;
25
- referencedColumnName: string;
26
- };
27
- export type ColumnsInfo = {
28
- name: string;
29
- type: string;
30
- nullable?: boolean;
31
- default?: string | null;
32
- primary?: boolean;
33
- unique?: boolean;
34
- autoIncrement?: boolean;
35
- length?: number;
36
- isEnum?: boolean;
37
- precision?: number;
38
- scale?: number;
39
- isDecimal?: boolean;
40
- enumItems?: string[] | number[];
41
- foreignKeys?: ForeignKeyInfo[];
42
- };
43
- export type SqlActionType = 'CREATE' | 'DELETE' | 'ALTER' | 'INDEX';
44
- export type IndexTable = {
45
- name: string;
46
- properties?: string[];
47
- where?: string;
48
- };
49
- export type UniqueTable = {
50
- name: string;
51
- properties?: string[];
52
- };
53
- export type ColDiff = {
54
- actionType: SqlActionType;
55
- colName: string;
56
- colType?: string;
57
- colLength?: number;
58
- indexTables?: IndexTable[];
59
- uniqueTables?: UniqueTable[];
60
- colChanges?: {
61
- default?: string | null;
62
- primary?: boolean;
63
- unique?: boolean;
64
- nullable?: boolean;
65
- autoIncrement?: boolean;
66
- enumItems?: string[] | number[];
67
- enumModified?: boolean;
68
- precision?: number;
69
- scale?: number;
70
- foreignKeys?: ForeignKeyInfo[];
71
- };
72
- };
73
- export type TableDiff = {
74
- tableName: string;
75
- schema?: string;
76
- newTable?: boolean;
77
- colDiffs: ColDiff[];
78
- };
79
- export declare class Migrator {
80
- config: ConnectionSettings<any>;
81
- orm: Orm<any>;
82
- entities: EntityStorage;
83
- knex: knex.Knex;
84
- constructor();
85
- startConnection(basePath?: string): Promise<void>;
86
- private initConfigFile;
87
- private initOrm;
88
- private initKnex;
89
- private run;
90
- private createTable;
91
- private buildPartialIndexStatements;
92
- private collectPartialIndexTables;
93
- private buildPartialIndexStatement;
94
- private ensureStatement;
95
- private isPartialIndexTable;
96
- private formatIndexColumns;
97
- private sortTablesByDependencies;
98
- private dropEnumConstraints;
99
- assignType(builder: knex.Knex.AlterTableBuilder, diff: ColDiff, tableDiff: TableDiff): knex.Knex.ColumnBuilder;
100
- migrate(): Promise<void>;
101
- generateMigration(configFile?: string, onlySql?: boolean): Promise<any[]>;
102
- private lastTreatment;
103
- private normalizeSnapshotTypes;
104
- private normalizeIndexes;
105
- private normalizeIndex;
106
- private isIndexDefinition;
107
- private parseIndexDefinition;
108
- private extractIndexColumns;
109
- private extractFirstParenContent;
110
- private normalizeIndexColumns;
111
- private cleanIndexToken;
112
- private extractIndexWhere;
113
- private snapshotBd;
114
- private snapshotEntities;
115
- destroy(): Promise<void>;
116
- }