kysely 0.2.4 → 0.2.5
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/README.md +1 -1
- package/lib/dialect/postgres/postgres-dialect.js +5 -4
- package/lib/index.d.ts +66 -2
- package/lib/index.js +66 -2
- package/lib/kysely.d.ts +15 -14
- package/lib/kysely.js +17 -16
- package/lib/migration/migration.js +2 -2
- package/lib/operation-node/add-column-node.d.ts +6 -19
- package/lib/operation-node/add-column-node.js +5 -14
- package/lib/operation-node/add-constraint-node.d.ts +4 -4
- package/lib/operation-node/add-constraint-node.js +3 -0
- package/lib/operation-node/alias-node.d.ts +4 -2
- package/lib/operation-node/alias-node.js +3 -0
- package/lib/operation-node/alter-column-node.d.ts +6 -1
- package/lib/operation-node/alter-column-node.js +11 -2
- package/lib/operation-node/alter-table-node.d.ts +5 -0
- package/lib/operation-node/alter-table-node.js +9 -0
- package/lib/operation-node/and-node.d.ts +3 -0
- package/lib/operation-node/and-node.js +3 -0
- package/lib/operation-node/check-constraint-node.d.ts +3 -0
- package/lib/operation-node/check-constraint-node.js +3 -0
- package/lib/operation-node/column-definition-node.d.ts +29 -0
- package/lib/operation-node/column-definition-node.js +30 -0
- package/lib/operation-node/column-node.d.ts +3 -0
- package/lib/operation-node/column-node.js +3 -0
- package/lib/operation-node/column-update-node.d.ts +3 -0
- package/lib/operation-node/column-update-node.js +3 -0
- package/lib/operation-node/common-table-expression-node.d.ts +3 -0
- package/lib/operation-node/common-table-expression-node.js +3 -0
- package/lib/operation-node/constraint-node.d.ts +5 -0
- package/lib/operation-node/constraint-node.js +2 -0
- package/lib/operation-node/create-index-node.d.ts +3 -0
- package/lib/operation-node/create-index-node.js +3 -0
- package/lib/operation-node/create-schema-node.d.ts +3 -0
- package/lib/operation-node/create-schema-node.js +3 -0
- package/lib/operation-node/create-table-node.d.ts +9 -9
- package/lib/operation-node/create-table-node.js +23 -5
- package/lib/operation-node/data-type-node.d.ts +3 -0
- package/lib/operation-node/data-type-node.js +3 -0
- package/lib/operation-node/delete-query-node.d.ts +3 -0
- package/lib/operation-node/delete-query-node.js +3 -0
- package/lib/operation-node/drop-column-node.d.ts +3 -0
- package/lib/operation-node/drop-column-node.js +3 -0
- package/lib/operation-node/drop-constraint-node.d.ts +3 -0
- package/lib/operation-node/drop-constraint-node.js +3 -0
- package/lib/operation-node/drop-index-node.d.ts +3 -0
- package/lib/operation-node/drop-index-node.js +3 -0
- package/lib/operation-node/drop-schema-node.d.ts +3 -0
- package/lib/operation-node/drop-schema-node.js +3 -0
- package/lib/operation-node/drop-table-node.d.ts +5 -2
- package/lib/operation-node/drop-table-node.js +3 -0
- package/lib/operation-node/filter-node.d.ts +3 -0
- package/lib/operation-node/filter-node.js +3 -0
- package/lib/operation-node/foreign-key-constraint-node.d.ts +5 -1
- package/lib/operation-node/foreign-key-constraint-node.js +6 -2
- package/lib/operation-node/from-node.d.ts +3 -0
- package/lib/operation-node/from-node.js +3 -0
- package/lib/operation-node/group-by-item-node.d.ts +3 -0
- package/lib/operation-node/group-by-item-node.js +3 -0
- package/lib/operation-node/group-by-node.d.ts +3 -0
- package/lib/operation-node/group-by-node.js +3 -0
- package/lib/operation-node/having-node.d.ts +3 -0
- package/lib/operation-node/having-node.js +3 -0
- package/lib/operation-node/identifier-node.d.ts +3 -0
- package/lib/operation-node/identifier-node.js +3 -0
- package/lib/operation-node/insert-query-node.d.ts +3 -0
- package/lib/operation-node/insert-query-node.js +3 -0
- package/lib/operation-node/join-node.d.ts +3 -0
- package/lib/operation-node/join-node.js +3 -0
- package/lib/operation-node/limit-node.d.ts +3 -0
- package/lib/operation-node/limit-node.js +3 -0
- package/lib/operation-node/list-node.d.ts +3 -0
- package/lib/operation-node/list-node.js +3 -0
- package/lib/operation-node/offset-node.d.ts +3 -0
- package/lib/operation-node/offset-node.js +3 -0
- package/lib/operation-node/on-conflict-node.d.ts +3 -0
- package/lib/operation-node/on-conflict-node.js +3 -0
- package/lib/operation-node/operation-node-transformer.d.ts +2 -0
- package/lib/operation-node/operation-node-transformer.js +12 -6
- package/lib/operation-node/operation-node-visitor.d.ts +2 -0
- package/lib/operation-node/operation-node-visitor.js +12 -1
- package/lib/operation-node/operation-node.d.ts +1 -1
- package/lib/operation-node/operator-node.d.ts +3 -0
- package/lib/operation-node/operator-node.js +3 -0
- package/lib/operation-node/or-node.d.ts +3 -0
- package/lib/operation-node/or-node.js +3 -0
- package/lib/operation-node/order-by-item-node.d.ts +3 -0
- package/lib/operation-node/order-by-item-node.js +3 -0
- package/lib/operation-node/order-by-node.d.ts +3 -0
- package/lib/operation-node/order-by-node.js +3 -0
- package/lib/operation-node/parens-node.d.ts +3 -0
- package/lib/operation-node/parens-node.js +3 -0
- package/lib/operation-node/primary-constraint-node.d.ts +3 -0
- package/lib/operation-node/primary-constraint-node.js +3 -0
- package/lib/operation-node/primitive-value-list-node.d.ts +3 -0
- package/lib/operation-node/primitive-value-list-node.js +3 -0
- package/lib/operation-node/query-node.d.ts +3 -0
- package/lib/operation-node/query-node.js +3 -0
- package/lib/operation-node/raw-node.d.ts +3 -0
- package/lib/operation-node/raw-node.js +3 -0
- package/lib/operation-node/reference-node.d.ts +3 -0
- package/lib/operation-node/reference-node.js +3 -0
- package/lib/operation-node/references-node.d.ts +5 -2
- package/lib/operation-node/references-node.js +5 -2
- package/lib/operation-node/rename-column-node.d.ts +4 -1
- package/lib/operation-node/rename-column-node.js +5 -2
- package/lib/operation-node/returning-node.d.ts +3 -0
- package/lib/operation-node/returning-node.js +3 -0
- package/lib/operation-node/select-all-node.d.ts +3 -0
- package/lib/operation-node/select-all-node.js +3 -0
- package/lib/operation-node/select-query-node.d.ts +3 -0
- package/lib/operation-node/select-query-node.js +3 -0
- package/lib/operation-node/selection-node.d.ts +3 -0
- package/lib/operation-node/selection-node.js +3 -0
- package/lib/operation-node/table-node.d.ts +3 -0
- package/lib/operation-node/table-node.js +3 -0
- package/lib/operation-node/unique-constraint-node.d.ts +3 -0
- package/lib/operation-node/unique-constraint-node.js +3 -0
- package/lib/operation-node/update-query-node.d.ts +3 -0
- package/lib/operation-node/update-query-node.js +3 -0
- package/lib/operation-node/value-list-node.d.ts +3 -0
- package/lib/operation-node/value-list-node.js +3 -0
- package/lib/operation-node/value-node.d.ts +3 -0
- package/lib/operation-node/value-node.js +3 -0
- package/lib/operation-node/where-node.d.ts +3 -0
- package/lib/operation-node/where-node.js +3 -0
- package/lib/operation-node/with-node.d.ts +3 -0
- package/lib/operation-node/with-node.js +3 -0
- package/lib/parser/with-parser.js +1 -1
- package/lib/query-builder/query-builder.d.ts +9 -9
- package/lib/query-builder/query-builder.js +6 -6
- package/lib/query-builder/sub-query-builder.d.ts +1 -1
- package/lib/query-builder/sub-query-builder.js +1 -1
- package/lib/query-compiler/default-query-compiler.d.ts +3 -1
- package/lib/query-compiler/default-query-compiler.js +10 -9
- package/lib/query-compiler/query-compiler.d.ts +2 -1
- package/lib/query-creator.d.ts +2 -2
- package/lib/query-creator.js +1 -1
- package/lib/{util → query-executor}/query-executor.d.ts +0 -0
- package/lib/{util → query-executor}/query-executor.js +1 -1
- package/lib/raw-builder/raw-builder.d.ts +2 -2
- package/lib/raw-builder/raw-builder.js +4 -4
- package/lib/schema/alter-table-builder.d.ts +64 -0
- package/lib/schema/alter-table-builder.js +236 -0
- package/lib/schema/{add-column-builder.d.ts → column-definition-builder.d.ts} +23 -13
- package/lib/schema/column-definition-builder.js +66 -0
- package/lib/schema/create-index-builder.d.ts +2 -2
- package/lib/schema/create-index-builder.js +3 -3
- package/lib/schema/create-schema-builder.d.ts +2 -2
- package/lib/schema/create-schema-builder.js +3 -3
- package/lib/schema/create-table-builder.d.ts +20 -6
- package/lib/schema/create-table-builder.js +27 -8
- package/lib/schema/drop-index-builder.d.ts +2 -2
- package/lib/schema/drop-index-builder.js +3 -3
- package/lib/schema/drop-schema-builder.d.ts +2 -2
- package/lib/schema/drop-schema-builder.js +3 -3
- package/lib/schema/drop-table-builder.d.ts +2 -2
- package/lib/schema/drop-table-builder.js +3 -3
- package/lib/schema/schema.d.ts +17 -3
- package/lib/schema/schema.js +22 -2
- package/lib/transformers/with-schema-transformer.d.ts +2 -0
- package/lib/transformers/with-schema-transformer.js +3 -0
- package/lib/util/object-utils.d.ts +1 -0
- package/lib/util/object-utils.js +13 -1
- package/package.json +2 -2
- package/lib/schema/add-column-builder.js +0 -116
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AlterTableAddColumnBuilder = exports.AlterTableExecutor = exports.AlterColumnBuilder = exports.AlterTableBuilder = void 0;
|
|
4
|
+
const __1 = require("..");
|
|
5
|
+
const add_column_node_1 = require("../operation-node/add-column-node");
|
|
6
|
+
const alter_column_node_1 = require("../operation-node/alter-column-node");
|
|
7
|
+
const alter_table_node_1 = require("../operation-node/alter-table-node");
|
|
8
|
+
const column_definition_node_1 = require("../operation-node/column-definition-node");
|
|
9
|
+
const data_type_node_1 = require("../operation-node/data-type-node");
|
|
10
|
+
const drop_column_node_1 = require("../operation-node/drop-column-node");
|
|
11
|
+
const identifier_node_1 = require("../operation-node/identifier-node");
|
|
12
|
+
const operation_node_source_1 = require("../operation-node/operation-node-source");
|
|
13
|
+
const rename_column_node_1 = require("../operation-node/rename-column-node");
|
|
14
|
+
const table_node_1 = require("../operation-node/table-node");
|
|
15
|
+
const value_node_1 = require("../operation-node/value-node");
|
|
16
|
+
const prevent_await_1 = require("../util/prevent-await");
|
|
17
|
+
class AlterTableBuilder {
|
|
18
|
+
#alterTableNode;
|
|
19
|
+
#executor;
|
|
20
|
+
constructor(args) {
|
|
21
|
+
this.#alterTableNode = args.alterTableNode;
|
|
22
|
+
this.#executor = args.executor;
|
|
23
|
+
}
|
|
24
|
+
renameTo(newTableName) {
|
|
25
|
+
return new AlterTableExecutor({
|
|
26
|
+
executor: this.#executor,
|
|
27
|
+
alterTableNode: alter_table_node_1.alterTableNode.cloneWith(this.#alterTableNode, {
|
|
28
|
+
renameTo: table_node_1.tableNode.create(newTableName),
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
setSchema(newSchema) {
|
|
33
|
+
return new AlterTableExecutor({
|
|
34
|
+
executor: this.#executor,
|
|
35
|
+
alterTableNode: alter_table_node_1.alterTableNode.cloneWith(this.#alterTableNode, {
|
|
36
|
+
setSchema: identifier_node_1.identifierNode.create(newSchema),
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
alterColumn(column) {
|
|
41
|
+
return new AlterColumnBuilder({
|
|
42
|
+
alterTableNode: this.#alterTableNode,
|
|
43
|
+
alterColumnNode: alter_column_node_1.alterColumnNode.create(column),
|
|
44
|
+
executor: this.#executor,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
dropColumn(column) {
|
|
48
|
+
return new AlterTableExecutor({
|
|
49
|
+
executor: this.#executor,
|
|
50
|
+
alterTableNode: alter_table_node_1.alterTableNode.cloneWith(this.#alterTableNode, {
|
|
51
|
+
dropColumn: drop_column_node_1.dropColumnNode.create(column),
|
|
52
|
+
}),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
renameColumn(column, newColumn) {
|
|
56
|
+
return new AlterTableExecutor({
|
|
57
|
+
executor: this.#executor,
|
|
58
|
+
alterTableNode: alter_table_node_1.alterTableNode.cloneWith(this.#alterTableNode, {
|
|
59
|
+
renameColumn: rename_column_node_1.renameColumnNode.create(column, newColumn),
|
|
60
|
+
}),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
addColumn(columnName, dataType) {
|
|
64
|
+
return new AlterTableAddColumnBuilder({
|
|
65
|
+
executor: this.#executor,
|
|
66
|
+
alterTableNode: this.#alterTableNode,
|
|
67
|
+
columnBuilder: new __1.ColumnDefinitionBuilder(column_definition_node_1.columnDefinitionNode.create(columnName, operation_node_source_1.isOperationNodeSource(dataType)
|
|
68
|
+
? dataType.toOperationNode()
|
|
69
|
+
: data_type_node_1.dataTypeNode.create(dataType))),
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.AlterTableBuilder = AlterTableBuilder;
|
|
74
|
+
class AlterColumnBuilder {
|
|
75
|
+
#alterTableNode;
|
|
76
|
+
#alterColumnNode;
|
|
77
|
+
#executor;
|
|
78
|
+
constructor(args) {
|
|
79
|
+
this.#alterTableNode = args.alterTableNode;
|
|
80
|
+
this.#alterColumnNode = args.alterColumnNode;
|
|
81
|
+
this.#executor = args.executor;
|
|
82
|
+
}
|
|
83
|
+
setDataType(dataType) {
|
|
84
|
+
return new AlterTableExecutor({
|
|
85
|
+
executor: this.#executor,
|
|
86
|
+
alterTableNode: alter_table_node_1.alterTableNode.cloneWith(this.#alterTableNode, {
|
|
87
|
+
alterColumn: alter_column_node_1.alterColumnNode.cloneWith(this.#alterColumnNode, {
|
|
88
|
+
dataType: data_type_node_1.dataTypeNode.create(dataType),
|
|
89
|
+
}),
|
|
90
|
+
}),
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
setDefault(value) {
|
|
94
|
+
return new AlterTableExecutor({
|
|
95
|
+
executor: this.#executor,
|
|
96
|
+
alterTableNode: alter_table_node_1.alterTableNode.cloneWith(this.#alterTableNode, {
|
|
97
|
+
alterColumn: alter_column_node_1.alterColumnNode.cloneWith(this.#alterColumnNode, {
|
|
98
|
+
setDefault: operation_node_source_1.isOperationNodeSource(value)
|
|
99
|
+
? value.toOperationNode()
|
|
100
|
+
: value_node_1.valueNode.createImmediate(value),
|
|
101
|
+
}),
|
|
102
|
+
}),
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
dropDefault() {
|
|
106
|
+
return new AlterTableExecutor({
|
|
107
|
+
executor: this.#executor,
|
|
108
|
+
alterTableNode: alter_table_node_1.alterTableNode.cloneWith(this.#alterTableNode, {
|
|
109
|
+
alterColumn: alter_column_node_1.alterColumnNode.cloneWith(this.#alterColumnNode, {
|
|
110
|
+
dropDefault: true,
|
|
111
|
+
}),
|
|
112
|
+
}),
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
setNotNull() {
|
|
116
|
+
return new AlterTableExecutor({
|
|
117
|
+
executor: this.#executor,
|
|
118
|
+
alterTableNode: alter_table_node_1.alterTableNode.cloneWith(this.#alterTableNode, {
|
|
119
|
+
alterColumn: alter_column_node_1.alterColumnNode.cloneWith(this.#alterColumnNode, {
|
|
120
|
+
setNotNull: true,
|
|
121
|
+
}),
|
|
122
|
+
}),
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
dropNotNull() {
|
|
126
|
+
return new AlterTableExecutor({
|
|
127
|
+
executor: this.#executor,
|
|
128
|
+
alterTableNode: alter_table_node_1.alterTableNode.cloneWith(this.#alterTableNode, {
|
|
129
|
+
alterColumn: alter_column_node_1.alterColumnNode.cloneWith(this.#alterColumnNode, {
|
|
130
|
+
dropNotNull: true,
|
|
131
|
+
}),
|
|
132
|
+
}),
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
exports.AlterColumnBuilder = AlterColumnBuilder;
|
|
137
|
+
class AlterTableExecutor {
|
|
138
|
+
#alterTableNode;
|
|
139
|
+
#executor;
|
|
140
|
+
constructor(args) {
|
|
141
|
+
this.#alterTableNode = args.alterTableNode;
|
|
142
|
+
this.#executor = args.executor;
|
|
143
|
+
}
|
|
144
|
+
toOperationNode() {
|
|
145
|
+
return this.#executor.transformNode(this.#alterTableNode);
|
|
146
|
+
}
|
|
147
|
+
compile() {
|
|
148
|
+
return this.#executor.compileQuery(this.toOperationNode());
|
|
149
|
+
}
|
|
150
|
+
async execute() {
|
|
151
|
+
await this.#executor.executeQuery(this.compile());
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
exports.AlterTableExecutor = AlterTableExecutor;
|
|
155
|
+
class AlterTableAddColumnBuilder {
|
|
156
|
+
#alterTableNode;
|
|
157
|
+
#executor;
|
|
158
|
+
#columnBuilder;
|
|
159
|
+
constructor(args) {
|
|
160
|
+
this.#alterTableNode = args.alterTableNode;
|
|
161
|
+
this.#executor = args.executor;
|
|
162
|
+
this.#columnBuilder = args.columnBuilder;
|
|
163
|
+
}
|
|
164
|
+
increments() {
|
|
165
|
+
return new AlterTableAddColumnBuilder({
|
|
166
|
+
executor: this.#executor,
|
|
167
|
+
alterTableNode: this.#alterTableNode,
|
|
168
|
+
columnBuilder: this.#columnBuilder.increments(),
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
primaryKey() {
|
|
172
|
+
return new AlterTableAddColumnBuilder({
|
|
173
|
+
executor: this.#executor,
|
|
174
|
+
alterTableNode: this.#alterTableNode,
|
|
175
|
+
columnBuilder: this.#columnBuilder.primaryKey(),
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
references(ref) {
|
|
179
|
+
return new AlterTableAddColumnBuilder({
|
|
180
|
+
executor: this.#executor,
|
|
181
|
+
alterTableNode: this.#alterTableNode,
|
|
182
|
+
columnBuilder: this.#columnBuilder.references(ref),
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
onDelete(onDelete) {
|
|
186
|
+
return new AlterTableAddColumnBuilder({
|
|
187
|
+
executor: this.#executor,
|
|
188
|
+
alterTableNode: this.#alterTableNode,
|
|
189
|
+
columnBuilder: this.#columnBuilder.onDelete(onDelete),
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
unique() {
|
|
193
|
+
return new AlterTableAddColumnBuilder({
|
|
194
|
+
executor: this.#executor,
|
|
195
|
+
alterTableNode: this.#alterTableNode,
|
|
196
|
+
columnBuilder: this.#columnBuilder.unique(),
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
notNull() {
|
|
200
|
+
return new AlterTableAddColumnBuilder({
|
|
201
|
+
executor: this.#executor,
|
|
202
|
+
alterTableNode: this.#alterTableNode,
|
|
203
|
+
columnBuilder: this.#columnBuilder.notNull(),
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
defaultTo(value) {
|
|
207
|
+
return new AlterTableAddColumnBuilder({
|
|
208
|
+
executor: this.#executor,
|
|
209
|
+
alterTableNode: this.#alterTableNode,
|
|
210
|
+
columnBuilder: this.#columnBuilder.defaultTo(value),
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
check(sql) {
|
|
214
|
+
return new AlterTableAddColumnBuilder({
|
|
215
|
+
executor: this.#executor,
|
|
216
|
+
alterTableNode: this.#alterTableNode,
|
|
217
|
+
columnBuilder: this.#columnBuilder.check(sql),
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
toOperationNode() {
|
|
221
|
+
return this.#executor.transformNode(alter_table_node_1.alterTableNode.cloneWith(this.#alterTableNode, {
|
|
222
|
+
addColumn: add_column_node_1.addColumnNode.create(this.#columnBuilder.toOperationNode()),
|
|
223
|
+
}));
|
|
224
|
+
}
|
|
225
|
+
compile() {
|
|
226
|
+
return this.#executor.compileQuery(this.toOperationNode());
|
|
227
|
+
}
|
|
228
|
+
async execute() {
|
|
229
|
+
await this.#executor.executeQuery(this.compile());
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
exports.AlterTableAddColumnBuilder = AlterTableAddColumnBuilder;
|
|
233
|
+
prevent_await_1.preventAwait(AlterTableBuilder, "don't await AlterTableBuilder instances");
|
|
234
|
+
prevent_await_1.preventAwait(AlterColumnBuilder, "don't await AlterColumnBuilder instances");
|
|
235
|
+
prevent_await_1.preventAwait(AlterTableExecutor, "don't await AlterTableExecutor instances directly. To execute the query you need to call `execute`");
|
|
236
|
+
prevent_await_1.preventAwait(AlterTableAddColumnBuilder, "don't await AlterTableAddColumnBuilder instances directly. To execute the query you need to call `execute`");
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { AddColumnNode } from '../operation-node/add-column-node';
|
|
2
1
|
import { OperationNodeSource } from '../operation-node/operation-node-source';
|
|
3
2
|
import { OnDelete } from '../operation-node/references-node';
|
|
4
3
|
import { RawBuilder } from '../raw-builder/raw-builder';
|
|
5
4
|
import { PrimitiveValue } from '../util/object-utils';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
constructor(node: AddColumnNode);
|
|
5
|
+
import { ColumnDefinitionNode } from '../operation-node/column-definition-node';
|
|
6
|
+
export interface ColumnDefinitionBuilderInterface<R> {
|
|
9
7
|
/**
|
|
10
8
|
* Makes the column automatically incrementing.
|
|
11
9
|
*
|
|
@@ -13,14 +11,14 @@ export declare class AddColumnBuilder implements OperationNodeSource {
|
|
|
13
11
|
* on postgres this sets the column type to `serial` no matter what you
|
|
14
12
|
* have specified before.
|
|
15
13
|
*/
|
|
16
|
-
increments():
|
|
14
|
+
increments(): R;
|
|
17
15
|
/**
|
|
18
16
|
* Makes the column the primary key.
|
|
19
17
|
*
|
|
20
18
|
* If you want to specify a composite primary key use the
|
|
21
19
|
* {@link TableBuilder.addPrimaryKeyConstraint} method.
|
|
22
20
|
*/
|
|
23
|
-
primaryKey():
|
|
21
|
+
primaryKey(): R;
|
|
24
22
|
/**
|
|
25
23
|
* Adds a foreign key constraint for the column.
|
|
26
24
|
*
|
|
@@ -29,19 +27,19 @@ export declare class AddColumnBuilder implements OperationNodeSource {
|
|
|
29
27
|
* col.references('person.id')
|
|
30
28
|
* ```
|
|
31
29
|
*/
|
|
32
|
-
references(ref: string):
|
|
30
|
+
references(ref: string): R;
|
|
33
31
|
/**
|
|
34
32
|
* Adds an `on delete` constraint for the foreign key column.
|
|
35
33
|
*/
|
|
36
|
-
onDelete(onDelete: OnDelete):
|
|
34
|
+
onDelete(onDelete: OnDelete): R;
|
|
37
35
|
/**
|
|
38
36
|
* Adds a unique constraint for the column.
|
|
39
37
|
*/
|
|
40
|
-
unique():
|
|
38
|
+
unique(): R;
|
|
41
39
|
/**
|
|
42
40
|
* Adds a `not null` constraint for the column.
|
|
43
41
|
*/
|
|
44
|
-
|
|
42
|
+
notNull(): R;
|
|
45
43
|
/**
|
|
46
44
|
* Adds a default value constraint for the column.
|
|
47
45
|
*
|
|
@@ -53,7 +51,7 @@ export declare class AddColumnBuilder implements OperationNodeSource {
|
|
|
53
51
|
* .execute()
|
|
54
52
|
* ```
|
|
55
53
|
*/
|
|
56
|
-
defaultTo(value: PrimitiveValue | RawBuilder<any>):
|
|
54
|
+
defaultTo(value: PrimitiveValue | RawBuilder<any>): R;
|
|
57
55
|
/**
|
|
58
56
|
* Adds a check constraint for the column.
|
|
59
57
|
*
|
|
@@ -65,6 +63,18 @@ export declare class AddColumnBuilder implements OperationNodeSource {
|
|
|
65
63
|
* .execute()
|
|
66
64
|
* ```
|
|
67
65
|
*/
|
|
68
|
-
check(sql: string):
|
|
69
|
-
|
|
66
|
+
check(sql: string): R;
|
|
67
|
+
}
|
|
68
|
+
export declare class ColumnDefinitionBuilder implements ColumnDefinitionBuilderInterface<ColumnDefinitionBuilder>, OperationNodeSource {
|
|
69
|
+
#private;
|
|
70
|
+
constructor(node: ColumnDefinitionNode);
|
|
71
|
+
increments(): ColumnDefinitionBuilder;
|
|
72
|
+
primaryKey(): ColumnDefinitionBuilder;
|
|
73
|
+
references(ref: string): ColumnDefinitionBuilder;
|
|
74
|
+
onDelete(onDelete: OnDelete): ColumnDefinitionBuilder;
|
|
75
|
+
unique(): ColumnDefinitionBuilder;
|
|
76
|
+
notNull(): ColumnDefinitionBuilder;
|
|
77
|
+
defaultTo(value: PrimitiveValue | RawBuilder<any>): ColumnDefinitionBuilder;
|
|
78
|
+
check(sql: string): ColumnDefinitionBuilder;
|
|
79
|
+
toOperationNode(): ColumnDefinitionNode;
|
|
70
80
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ColumnDefinitionBuilder = void 0;
|
|
4
|
+
const check_constraint_node_1 = require("../operation-node/check-constraint-node");
|
|
5
|
+
const operation_node_source_1 = require("../operation-node/operation-node-source");
|
|
6
|
+
const reference_node_1 = require("../operation-node/reference-node");
|
|
7
|
+
const references_node_1 = require("../operation-node/references-node");
|
|
8
|
+
const select_all_node_1 = require("../operation-node/select-all-node");
|
|
9
|
+
const value_node_1 = require("../operation-node/value-node");
|
|
10
|
+
const reference_parser_1 = require("../parser/reference-parser");
|
|
11
|
+
const prevent_await_1 = require("../util/prevent-await");
|
|
12
|
+
const column_definition_node_1 = require("../operation-node/column-definition-node");
|
|
13
|
+
class ColumnDefinitionBuilder {
|
|
14
|
+
#node;
|
|
15
|
+
constructor(node) {
|
|
16
|
+
this.#node = node;
|
|
17
|
+
}
|
|
18
|
+
increments() {
|
|
19
|
+
return new ColumnDefinitionBuilder(column_definition_node_1.columnDefinitionNode.cloneWith(this.#node, { isAutoIncrementing: true }));
|
|
20
|
+
}
|
|
21
|
+
primaryKey() {
|
|
22
|
+
return new ColumnDefinitionBuilder(column_definition_node_1.columnDefinitionNode.cloneWith(this.#node, { isPrimaryKey: true }));
|
|
23
|
+
}
|
|
24
|
+
references(ref) {
|
|
25
|
+
const references = reference_parser_1.parseStringReference(ref);
|
|
26
|
+
if (!reference_node_1.referenceNode.is(references) || select_all_node_1.selectAllNode.is(references.column)) {
|
|
27
|
+
throw new Error(`invalid call references('${ref}'). The reference must have format table.column or schema.table.column`);
|
|
28
|
+
}
|
|
29
|
+
return new ColumnDefinitionBuilder(column_definition_node_1.columnDefinitionNode.cloneWith(this.#node, {
|
|
30
|
+
references: references_node_1.referencesNode.create(references.table, [
|
|
31
|
+
references.column,
|
|
32
|
+
]),
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
onDelete(onDelete) {
|
|
36
|
+
if (!this.#node.references) {
|
|
37
|
+
throw new Error('on delete constraint can only be added for foreign keys');
|
|
38
|
+
}
|
|
39
|
+
return new ColumnDefinitionBuilder(column_definition_node_1.columnDefinitionNode.cloneWith(this.#node, {
|
|
40
|
+
references: references_node_1.referencesNode.cloneWithOnDelete(this.#node.references, onDelete),
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
unique() {
|
|
44
|
+
return new ColumnDefinitionBuilder(column_definition_node_1.columnDefinitionNode.cloneWith(this.#node, { isUnique: true }));
|
|
45
|
+
}
|
|
46
|
+
notNull() {
|
|
47
|
+
return new ColumnDefinitionBuilder(column_definition_node_1.columnDefinitionNode.cloneWith(this.#node, { isNullable: false }));
|
|
48
|
+
}
|
|
49
|
+
defaultTo(value) {
|
|
50
|
+
return new ColumnDefinitionBuilder(column_definition_node_1.columnDefinitionNode.cloneWith(this.#node, {
|
|
51
|
+
defaultTo: operation_node_source_1.isOperationNodeSource(value)
|
|
52
|
+
? value.toOperationNode()
|
|
53
|
+
: value_node_1.valueNode.createImmediate(value),
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
check(sql) {
|
|
57
|
+
return new ColumnDefinitionBuilder(column_definition_node_1.columnDefinitionNode.cloneWith(this.#node, {
|
|
58
|
+
check: check_constraint_node_1.checkConstraintNode.create(sql),
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
toOperationNode() {
|
|
62
|
+
return this.#node;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.ColumnDefinitionBuilder = ColumnDefinitionBuilder;
|
|
66
|
+
prevent_await_1.preventAwait(ColumnDefinitionBuilder, "don't await ColumnBuilder instances directly.");
|
|
@@ -2,10 +2,10 @@ import { CreateIndexNode, IndexType } from '../operation-node/create-index-node'
|
|
|
2
2
|
import { OperationNodeSource } from '../operation-node/operation-node-source';
|
|
3
3
|
import { CompiledQuery } from '../query-compiler/compiled-query';
|
|
4
4
|
import { Compilable } from '../util/compilable';
|
|
5
|
-
import { QueryExecutor } from '../
|
|
5
|
+
import { QueryExecutor } from '../query-executor/query-executor';
|
|
6
6
|
export declare class CreateIndexBuilder implements OperationNodeSource, Compilable {
|
|
7
7
|
#private;
|
|
8
|
-
constructor(
|
|
8
|
+
constructor(args: CreateIndexBuilderConstructorArgs);
|
|
9
9
|
/**
|
|
10
10
|
* Makes the index unique.
|
|
11
11
|
*/
|
|
@@ -10,9 +10,9 @@ const prevent_await_1 = require("../util/prevent-await");
|
|
|
10
10
|
class CreateIndexBuilder {
|
|
11
11
|
#createIndexNode;
|
|
12
12
|
#executor;
|
|
13
|
-
constructor(
|
|
14
|
-
this.#createIndexNode = createIndexNode;
|
|
15
|
-
this.#executor = executor;
|
|
13
|
+
constructor(args) {
|
|
14
|
+
this.#createIndexNode = args.createIndexNode;
|
|
15
|
+
this.#executor = args.executor;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Makes the index unique.
|
|
@@ -2,10 +2,10 @@ import { CreateSchemaNode } from '../operation-node/create-schema-node';
|
|
|
2
2
|
import { OperationNodeSource } from '../operation-node/operation-node-source';
|
|
3
3
|
import { CompiledQuery } from '../query-compiler/compiled-query';
|
|
4
4
|
import { Compilable } from '../util/compilable';
|
|
5
|
-
import { QueryExecutor } from '../
|
|
5
|
+
import { QueryExecutor } from '../query-executor/query-executor';
|
|
6
6
|
export declare class CreateSchemaBuilder implements OperationNodeSource, Compilable {
|
|
7
7
|
#private;
|
|
8
|
-
constructor(
|
|
8
|
+
constructor(args: CreateSchemaBuilderConstructorArgs);
|
|
9
9
|
ifNotExists(): CreateSchemaBuilder;
|
|
10
10
|
toOperationNode(): CreateSchemaNode;
|
|
11
11
|
compile(): CompiledQuery;
|
|
@@ -6,9 +6,9 @@ const prevent_await_1 = require("../util/prevent-await");
|
|
|
6
6
|
class CreateSchemaBuilder {
|
|
7
7
|
#createSchemaNode;
|
|
8
8
|
#executor;
|
|
9
|
-
constructor(
|
|
10
|
-
this.#createSchemaNode = createSchemaNode;
|
|
11
|
-
this.#executor = executor;
|
|
9
|
+
constructor(args) {
|
|
10
|
+
this.#createSchemaNode = args.createSchemaNode;
|
|
11
|
+
this.#executor = args.executor;
|
|
12
12
|
}
|
|
13
13
|
ifNotExists() {
|
|
14
14
|
return new CreateSchemaBuilder({
|
|
@@ -4,11 +4,11 @@ import { ColumnDataType } from '../operation-node/data-type-node';
|
|
|
4
4
|
import { OperationNodeSource } from '../operation-node/operation-node-source';
|
|
5
5
|
import { CompiledQuery } from '../query-compiler/compiled-query';
|
|
6
6
|
import { Compilable } from '../util/compilable';
|
|
7
|
-
import { QueryExecutor } from '../
|
|
8
|
-
import {
|
|
7
|
+
import { QueryExecutor } from '../query-executor/query-executor';
|
|
8
|
+
import { ColumnDefinitionBuilder } from './column-definition-builder';
|
|
9
9
|
export declare class CreateTableBuilder implements OperationNodeSource, Compilable {
|
|
10
10
|
#private;
|
|
11
|
-
constructor(
|
|
11
|
+
constructor(args: CreateTableBuilderConstructorArgs);
|
|
12
12
|
/**
|
|
13
13
|
* Adds the "if not exists" modifier.
|
|
14
14
|
*
|
|
@@ -23,7 +23,7 @@ export declare class CreateTableBuilder implements OperationNodeSource, Compilab
|
|
|
23
23
|
* await db.schema
|
|
24
24
|
* .createTable('person')
|
|
25
25
|
* .addColumn('int', 'id', (col) => col.increments().primary()),
|
|
26
|
-
* .addColumn('first_name', 'varchar(50), (col) => col.
|
|
26
|
+
* .addColumn('first_name', 'varchar(50), (col) => col.notNull())
|
|
27
27
|
* .addColumn('varchar', 'last_name')
|
|
28
28
|
* .addColumn('numeric(8, 2)', 'bank_balance')
|
|
29
29
|
* .addColumn('data', db.raw('customtype'))
|
|
@@ -53,10 +53,24 @@ export declare class CreateTableBuilder implements OperationNodeSource, Compilab
|
|
|
53
53
|
*
|
|
54
54
|
* @example
|
|
55
55
|
* ```ts
|
|
56
|
-
* addCheckConstraint('number_of_legs < 5')
|
|
56
|
+
* addCheckConstraint('check_legs', 'number_of_legs < 5')
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
59
|
addCheckConstraint(constraintName: string, checkExpression: string): CreateTableBuilder;
|
|
60
|
+
/**
|
|
61
|
+
* Adds a foreign key constraint.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* addForeignKeyConstraint(
|
|
66
|
+
* 'owner_id_foreign',
|
|
67
|
+
* ['owner_id'],
|
|
68
|
+
* 'person',
|
|
69
|
+
* ['id'],
|
|
70
|
+
* )
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
addForeignKeyConstraint(constraintName: string, columns: string[], targetTable: string, targetColumns: string[]): CreateTableBuilder;
|
|
60
74
|
toOperationNode(): CreateTableNode;
|
|
61
75
|
compile(): CompiledQuery;
|
|
62
76
|
execute(): Promise<void>;
|
|
@@ -65,4 +79,4 @@ export interface CreateTableBuilderConstructorArgs {
|
|
|
65
79
|
createTableNode: CreateTableNode;
|
|
66
80
|
executor: QueryExecutor;
|
|
67
81
|
}
|
|
68
|
-
export declare type ColumnBuilderCallback = (tableBuilder:
|
|
82
|
+
export declare type ColumnBuilderCallback = (tableBuilder: ColumnDefinitionBuilder) => ColumnDefinitionBuilder;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CreateTableBuilder = void 0;
|
|
4
|
-
const
|
|
4
|
+
const column_definition_node_1 = require("../operation-node/column-definition-node");
|
|
5
5
|
const create_table_node_1 = require("../operation-node/create-table-node");
|
|
6
6
|
const data_type_node_1 = require("../operation-node/data-type-node");
|
|
7
7
|
const operation_node_source_1 = require("../operation-node/operation-node-source");
|
|
8
8
|
const prevent_await_1 = require("../util/prevent-await");
|
|
9
|
-
const
|
|
9
|
+
const column_definition_builder_1 = require("./column-definition-builder");
|
|
10
10
|
class CreateTableBuilder {
|
|
11
11
|
#createTableNode;
|
|
12
12
|
#executor;
|
|
13
|
-
constructor(
|
|
14
|
-
this.#createTableNode = createTableNode;
|
|
15
|
-
this.#executor = executor;
|
|
13
|
+
constructor(args) {
|
|
14
|
+
this.#createTableNode = args.createTableNode;
|
|
15
|
+
this.#executor = args.executor;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Adds the "if not exists" modifier.
|
|
@@ -33,14 +33,14 @@ class CreateTableBuilder {
|
|
|
33
33
|
* await db.schema
|
|
34
34
|
* .createTable('person')
|
|
35
35
|
* .addColumn('int', 'id', (col) => col.increments().primary()),
|
|
36
|
-
* .addColumn('first_name', 'varchar(50), (col) => col.
|
|
36
|
+
* .addColumn('first_name', 'varchar(50), (col) => col.notNull())
|
|
37
37
|
* .addColumn('varchar', 'last_name')
|
|
38
38
|
* .addColumn('numeric(8, 2)', 'bank_balance')
|
|
39
39
|
* .addColumn('data', db.raw('customtype'))
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
42
|
addColumn(columnName, dataType, build) {
|
|
43
|
-
let columnBuilder = new
|
|
43
|
+
let columnBuilder = new column_definition_builder_1.ColumnDefinitionBuilder(column_definition_node_1.columnDefinitionNode.create(columnName, operation_node_source_1.isOperationNodeSource(dataType)
|
|
44
44
|
? dataType.toOperationNode()
|
|
45
45
|
: data_type_node_1.dataTypeNode.create(dataType)));
|
|
46
46
|
if (build) {
|
|
@@ -84,7 +84,7 @@ class CreateTableBuilder {
|
|
|
84
84
|
*
|
|
85
85
|
* @example
|
|
86
86
|
* ```ts
|
|
87
|
-
* addCheckConstraint('number_of_legs < 5')
|
|
87
|
+
* addCheckConstraint('check_legs', 'number_of_legs < 5')
|
|
88
88
|
* ```
|
|
89
89
|
*/
|
|
90
90
|
addCheckConstraint(constraintName, checkExpression) {
|
|
@@ -93,6 +93,25 @@ class CreateTableBuilder {
|
|
|
93
93
|
createTableNode: create_table_node_1.createTableNode.cloneWithCheckConstraint(this.#createTableNode, constraintName, checkExpression),
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Adds a foreign key constraint.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* addForeignKeyConstraint(
|
|
102
|
+
* 'owner_id_foreign',
|
|
103
|
+
* ['owner_id'],
|
|
104
|
+
* 'person',
|
|
105
|
+
* ['id'],
|
|
106
|
+
* )
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
addForeignKeyConstraint(constraintName, columns, targetTable, targetColumns) {
|
|
110
|
+
return new CreateTableBuilder({
|
|
111
|
+
executor: this.#executor,
|
|
112
|
+
createTableNode: create_table_node_1.createTableNode.cloneWithForeignKeyConstraint(this.#createTableNode, constraintName, columns, targetTable, targetColumns),
|
|
113
|
+
});
|
|
114
|
+
}
|
|
96
115
|
toOperationNode() {
|
|
97
116
|
return this.#executor.transformNode(this.#createTableNode);
|
|
98
117
|
}
|
|
@@ -2,10 +2,10 @@ import { DropIndexNode } from '../operation-node/drop-index-node';
|
|
|
2
2
|
import { OperationNodeSource } from '../operation-node/operation-node-source';
|
|
3
3
|
import { CompiledQuery } from '../query-compiler/compiled-query';
|
|
4
4
|
import { Compilable } from '../util/compilable';
|
|
5
|
-
import { QueryExecutor } from '../
|
|
5
|
+
import { QueryExecutor } from '../query-executor/query-executor';
|
|
6
6
|
export declare class DropIndexBuilder implements OperationNodeSource, Compilable {
|
|
7
7
|
#private;
|
|
8
|
-
constructor(
|
|
8
|
+
constructor(args: DropIndexBuilderConstructorArgs);
|
|
9
9
|
ifExists(): DropIndexBuilder;
|
|
10
10
|
toOperationNode(): DropIndexNode;
|
|
11
11
|
compile(): CompiledQuery;
|
|
@@ -6,9 +6,9 @@ const prevent_await_1 = require("../util/prevent-await");
|
|
|
6
6
|
class DropIndexBuilder {
|
|
7
7
|
#dropIndexNode;
|
|
8
8
|
#executor;
|
|
9
|
-
constructor(
|
|
10
|
-
this.#dropIndexNode = dropIndexNode;
|
|
11
|
-
this.#executor = executor;
|
|
9
|
+
constructor(args) {
|
|
10
|
+
this.#dropIndexNode = args.dropIndexNode;
|
|
11
|
+
this.#executor = args.executor;
|
|
12
12
|
}
|
|
13
13
|
ifExists() {
|
|
14
14
|
return new DropIndexBuilder({
|
|
@@ -2,10 +2,10 @@ import { DropSchemaNode } from '../operation-node/drop-schema-node';
|
|
|
2
2
|
import { OperationNodeSource } from '../operation-node/operation-node-source';
|
|
3
3
|
import { CompiledQuery } from '../query-compiler/compiled-query';
|
|
4
4
|
import { Compilable } from '../util/compilable';
|
|
5
|
-
import { QueryExecutor } from '../
|
|
5
|
+
import { QueryExecutor } from '../query-executor/query-executor';
|
|
6
6
|
export declare class DropSchemaBuilder implements OperationNodeSource, Compilable {
|
|
7
7
|
#private;
|
|
8
|
-
constructor(
|
|
8
|
+
constructor(args: DropSchemaBuilderConstructorArgs);
|
|
9
9
|
ifExists(): DropSchemaBuilder;
|
|
10
10
|
toOperationNode(): DropSchemaNode;
|
|
11
11
|
compile(): CompiledQuery;
|
|
@@ -6,9 +6,9 @@ const prevent_await_1 = require("../util/prevent-await");
|
|
|
6
6
|
class DropSchemaBuilder {
|
|
7
7
|
#dropSchemaNode;
|
|
8
8
|
#executor;
|
|
9
|
-
constructor(
|
|
10
|
-
this.#dropSchemaNode = dropSchemaNode;
|
|
11
|
-
this.#executor = executor;
|
|
9
|
+
constructor(args) {
|
|
10
|
+
this.#dropSchemaNode = args.dropSchemaNode;
|
|
11
|
+
this.#executor = args.executor;
|
|
12
12
|
}
|
|
13
13
|
ifExists() {
|
|
14
14
|
return new DropSchemaBuilder({
|
|
@@ -2,10 +2,10 @@ import { DropTableNode } from '../operation-node/drop-table-node';
|
|
|
2
2
|
import { OperationNodeSource } from '../operation-node/operation-node-source';
|
|
3
3
|
import { CompiledQuery } from '../query-compiler/compiled-query';
|
|
4
4
|
import { Compilable } from '../util/compilable';
|
|
5
|
-
import { QueryExecutor } from '../
|
|
5
|
+
import { QueryExecutor } from '../query-executor/query-executor';
|
|
6
6
|
export declare class DropTableBuilder implements OperationNodeSource, Compilable {
|
|
7
7
|
#private;
|
|
8
|
-
constructor(
|
|
8
|
+
constructor(args: DropTableBuilderConstructorArgs);
|
|
9
9
|
ifExists(): DropTableBuilder;
|
|
10
10
|
toOperationNode(): DropTableNode;
|
|
11
11
|
compile(): CompiledQuery;
|
|
@@ -6,9 +6,9 @@ const prevent_await_1 = require("../util/prevent-await");
|
|
|
6
6
|
class DropTableBuilder {
|
|
7
7
|
#dropTableNode;
|
|
8
8
|
#executor;
|
|
9
|
-
constructor(
|
|
10
|
-
this.#dropTableNode = dropTableNode;
|
|
11
|
-
this.#executor = executor;
|
|
9
|
+
constructor(args) {
|
|
10
|
+
this.#dropTableNode = args.dropTableNode;
|
|
11
|
+
this.#executor = args.executor;
|
|
12
12
|
}
|
|
13
13
|
ifExists() {
|
|
14
14
|
return new DropTableBuilder({
|