This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 73
/
Operation.ts
146 lines (127 loc) · 3.07 KB
/
Operation.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import { AbstractDatabase } from '../abstract/AbstractDatabase';
export type OperationType =
'table.create' |
'table.rename' |
'table.comment.set' |
'table.drop' |
'table.index.create' |
'table.index.drop' |
'table.primary.set' |
'table.primary.drop' |
'table.unique.create' |
'table.unique.drop' |
'table.foreign.create' |
'table.foreign.drop' |
'column.create' |
'column.rename' |
'column.alter' |
'column.drop'
export interface Operation {
type: OperationType
priority: number
}
export interface MigrationResults {
results: Operation[]
previousDB: AbstractDatabase
newDB: AbstractDatabase
}
export interface TableCreateOperation extends Operation {
type: 'table.create'
table: string
}
export interface TableRenameOperation extends Operation {
type: 'table.rename'
fromName: string
toName: string
}
export interface TableCommentSetOperation extends Operation {
type: 'table.comment.set'
table: string
comment: string | undefined
}
export interface TableDropOperation extends Operation {
type: 'table.drop'
table: string
}
export interface TableIndexCreateOperation extends Operation {
type: 'table.index.create'
table: string
columns: string[]
indexName: string | undefined
indexType: string | undefined
}
export interface TableIndexDropOperation extends Operation {
type: 'table.index.drop'
table: string
columns: string[]
indexName: string | undefined
}
export interface TablePrimarySetOperation extends Operation {
type: 'table.primary.set'
table: string
column: string
columnType: string
}
export interface TablePrimaryDropOperation extends Operation {
type: 'table.primary.drop'
table: string,
primaryKeyName: string
}
export interface TableUniqueCreateOperation extends Operation {
type: 'table.unique.create'
table: string
columns: string[]
indexName: string | undefined
}
export interface TableUniqueDropOperation extends Operation {
type: 'table.unique.drop'
table: string
columns: string[]
indexName: string | undefined
}
export interface TableForeignCreateOperation extends Operation {
type: 'table.foreign.create'
table: string
column: string
referenceTable: string
referenceColumn: string
}
export interface TableForeignDropOperation extends Operation {
type: 'table.foreign.drop'
table: string
column: string
}
export interface ColumnCreateOperation extends Operation {
type: 'column.create'
table: string
column: string
columnType: string
args: any[]
comment: string | undefined
nullable: boolean
defaultValue: any
isPrimaryKey: boolean
autoIncrementable: boolean
}
export interface ColumnAlterOperation extends Operation {
type: 'column.alter'
table: string
column: string
columnType: string
args: any[]
comment: string | undefined
nullable: boolean
defaultValue: any,
isPrimaryKey: boolean
}
export interface ColumnRenameOperation extends Operation {
type: 'column.rename'
table: string
fromName: string
toName: string
}
export interface ColumnDropOperation extends Operation {
type: 'column.drop'
table: string
column: string
}