kysely 0.19.11 → 0.19.12
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/cjs/operation-node/create-table-node.d.ts +3 -1
- package/dist/cjs/operation-node/create-table-node.js +2 -1
- package/dist/cjs/operation-node/foreign-key-constraint-node.d.ts +2 -2
- package/dist/cjs/operation-node/references-node.d.ts +3 -1
- package/dist/cjs/operation-node/references-node.js +8 -1
- package/dist/cjs/parser/on-commit-action-parse.d.ts +2 -0
- package/dist/cjs/parser/on-commit-action-parse.js +11 -0
- package/dist/cjs/parser/on-modify-action-parser.d.ts +2 -0
- package/dist/cjs/parser/on-modify-action-parser.js +11 -0
- package/dist/cjs/query-compiler/default-query-compiler.d.ts +1 -0
- package/dist/cjs/query-compiler/default-query-compiler.js +19 -1
- package/dist/cjs/schema/column-definition-builder.js +3 -2
- package/dist/cjs/schema/create-table-builder.js +2 -1
- package/dist/cjs/schema/foreign-key-constraint-builder.js +3 -2
- package/dist/esm/operation-node/create-table-node.d.ts +3 -1
- package/dist/esm/operation-node/create-table-node.js +1 -0
- package/dist/esm/operation-node/foreign-key-constraint-node.d.ts +2 -2
- package/dist/esm/operation-node/references-node.d.ts +3 -1
- package/dist/esm/operation-node/references-node.js +7 -0
- package/dist/esm/parser/on-commit-action-parse.d.ts +2 -0
- package/dist/esm/parser/on-commit-action-parse.js +8 -0
- package/dist/esm/parser/on-modify-action-parser.d.ts +2 -0
- package/dist/esm/parser/on-modify-action-parser.js +8 -0
- package/dist/esm/query-compiler/default-query-compiler.d.ts +1 -0
- package/dist/esm/query-compiler/default-query-compiler.js +19 -1
- package/dist/esm/schema/column-definition-builder.js +3 -2
- package/dist/esm/schema/create-table-builder.js +2 -1
- package/dist/esm/schema/foreign-key-constraint-builder.js +3 -2
- package/package.json +1 -1
|
@@ -2,7 +2,9 @@ import { OperationNode } from './operation-node.js';
|
|
|
2
2
|
import { TableNode } from './table-node.js';
|
|
3
3
|
import { ConstraintNode } from './constraint-node.js';
|
|
4
4
|
import { ColumnDefinitionNode } from './column-definition-node.js';
|
|
5
|
-
|
|
5
|
+
import { ArrayItemType } from '../util/type-utils.js';
|
|
6
|
+
export declare const ON_COMMIT_ACTIONS: string[];
|
|
7
|
+
export declare type OnCommitAction = ArrayItemType<typeof ON_COMMIT_ACTIONS>;
|
|
6
8
|
export declare type CreateTableNodeParams = Omit<CreateTableNode, 'kind' | 'table' | 'columns' | 'constraints'>;
|
|
7
9
|
export interface CreateTableNode extends OperationNode {
|
|
8
10
|
readonly kind: 'CreateTableNode';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CreateTableNode = void 0;
|
|
3
|
+
exports.CreateTableNode = exports.ON_COMMIT_ACTIONS = void 0;
|
|
4
4
|
const object_utils_js_1 = require("../util/object-utils.js");
|
|
5
|
+
exports.ON_COMMIT_ACTIONS = ['preserve rows', 'delete rows', 'drop'];
|
|
5
6
|
/**
|
|
6
7
|
* @internal
|
|
7
8
|
*/
|
|
@@ -20,8 +20,8 @@ export declare const ForeignKeyConstraintNode: Readonly<{
|
|
|
20
20
|
create(sourceColumns: ReadonlyArray<ColumnNode>, targetTable: TableNode, targetColumns: ReadonlyArray<ColumnNode>, constraintName?: string): ForeignKeyConstraintNode;
|
|
21
21
|
cloneWith(node: ForeignKeyConstraintNode, props: ForeignKeyConstraintNodeProps): Readonly<{
|
|
22
22
|
name?: IdentifierNode | undefined;
|
|
23
|
-
onDelete?:
|
|
24
|
-
onUpdate?:
|
|
23
|
+
onDelete?: "no action" | "restrict" | "cascade" | "set null" | "set default" | undefined;
|
|
24
|
+
onUpdate?: "no action" | "restrict" | "cascade" | "set null" | "set default" | undefined;
|
|
25
25
|
kind: 'ForeignKeyConstraintNode';
|
|
26
26
|
columns: ReadonlyArray<ColumnNode>;
|
|
27
27
|
references: ReferencesNode;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { OperationNode } from './operation-node.js';
|
|
2
2
|
import { ColumnNode } from './column-node.js';
|
|
3
3
|
import { TableNode } from './table-node.js';
|
|
4
|
-
|
|
4
|
+
import { ArrayItemType } from '../util/type-utils.js';
|
|
5
|
+
export declare const ON_MODIFY_FOREIGN_ACTIONS: readonly ["no action", "restrict", "cascade", "set null", "set default"];
|
|
6
|
+
export declare type OnModifyForeignAction = ArrayItemType<typeof ON_MODIFY_FOREIGN_ACTIONS>;
|
|
5
7
|
export interface ReferencesNode extends OperationNode {
|
|
6
8
|
readonly kind: 'ReferencesNode';
|
|
7
9
|
readonly table: TableNode;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ReferencesNode = void 0;
|
|
3
|
+
exports.ReferencesNode = exports.ON_MODIFY_FOREIGN_ACTIONS = void 0;
|
|
4
4
|
const object_utils_js_1 = require("../util/object-utils.js");
|
|
5
|
+
exports.ON_MODIFY_FOREIGN_ACTIONS = [
|
|
6
|
+
'no action',
|
|
7
|
+
'restrict',
|
|
8
|
+
'cascade',
|
|
9
|
+
'set null',
|
|
10
|
+
'set default',
|
|
11
|
+
];
|
|
5
12
|
/**
|
|
6
13
|
* @internal
|
|
7
14
|
*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseOnCommitAction = void 0;
|
|
4
|
+
const create_table_node_js_1 = require("../operation-node/create-table-node.js");
|
|
5
|
+
function parseOnCommitAction(action) {
|
|
6
|
+
if (create_table_node_js_1.ON_COMMIT_ACTIONS.includes(action)) {
|
|
7
|
+
return action;
|
|
8
|
+
}
|
|
9
|
+
throw new Error(`invalid OnCommitAction ${action}`);
|
|
10
|
+
}
|
|
11
|
+
exports.parseOnCommitAction = parseOnCommitAction;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseOnModifyForeignAction = void 0;
|
|
4
|
+
const references_node_js_1 = require("../operation-node/references-node.js");
|
|
5
|
+
function parseOnModifyForeignAction(action) {
|
|
6
|
+
if (references_node_js_1.ON_MODIFY_FOREIGN_ACTIONS.includes(action)) {
|
|
7
|
+
return action;
|
|
8
|
+
}
|
|
9
|
+
throw new Error(`invalid OnModifyForeignAction ${action}`);
|
|
10
|
+
}
|
|
11
|
+
exports.parseOnModifyForeignAction = parseOnModifyForeignAction;
|
|
@@ -154,6 +154,7 @@ export declare class DefaultQueryCompiler extends OperationNodeVisitor implement
|
|
|
154
154
|
protected getLeftIdentifierWrapper(): string;
|
|
155
155
|
protected getRightIdentifierWrapper(): string;
|
|
156
156
|
protected getCurrentParameterPlaceholder(): string;
|
|
157
|
+
protected sanitizeIdentifier(identifier: string): string;
|
|
157
158
|
protected addParameter(parameter: unknown): void;
|
|
158
159
|
protected appendImmediateValue(value: unknown): void;
|
|
159
160
|
}
|
|
@@ -227,7 +227,7 @@ class DefaultQueryCompiler extends operation_node_visitor_js_1.OperationNodeVisi
|
|
|
227
227
|
this.append(this.getRightIdentifierWrapper());
|
|
228
228
|
}
|
|
229
229
|
compileUnwrappedIdentifier(node) {
|
|
230
|
-
this.append(node.identifier);
|
|
230
|
+
this.append(this.sanitizeIdentifier(node.identifier));
|
|
231
231
|
}
|
|
232
232
|
visitFilter(node) {
|
|
233
233
|
if (node.left) {
|
|
@@ -822,6 +822,24 @@ class DefaultQueryCompiler extends operation_node_visitor_js_1.OperationNodeVisi
|
|
|
822
822
|
getCurrentParameterPlaceholder() {
|
|
823
823
|
return '$' + this.numParameters;
|
|
824
824
|
}
|
|
825
|
+
sanitizeIdentifier(identifier) {
|
|
826
|
+
if (!(0, object_utils_js_1.isString)(identifier)) {
|
|
827
|
+
throw new Error('a non-string identifier was passed to sanitizeIdentifier.');
|
|
828
|
+
}
|
|
829
|
+
const leftWrap = this.getLeftIdentifierWrapper();
|
|
830
|
+
const rightWrap = this.getRightIdentifierWrapper();
|
|
831
|
+
let sanitized = '';
|
|
832
|
+
for (const c of identifier) {
|
|
833
|
+
sanitized += c;
|
|
834
|
+
if (c === leftWrap) {
|
|
835
|
+
sanitized += leftWrap;
|
|
836
|
+
}
|
|
837
|
+
else if (c === rightWrap) {
|
|
838
|
+
sanitized += rightWrap;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
return sanitized;
|
|
842
|
+
}
|
|
825
843
|
addParameter(parameter) {
|
|
826
844
|
this.#parameters.push(parameter);
|
|
827
845
|
}
|
|
@@ -11,6 +11,7 @@ const column_definition_node_js_1 = require("../operation-node/column-definition
|
|
|
11
11
|
const default_value_parser_js_1 = require("../parser/default-value-parser.js");
|
|
12
12
|
const generated_node_js_1 = require("../operation-node/generated-node.js");
|
|
13
13
|
const default_value_node_js_1 = require("../operation-node/default-value-node.js");
|
|
14
|
+
const on_modify_action_parser_js_1 = require("../parser/on-modify-action-parser.js");
|
|
14
15
|
class ColumnDefinitionBuilder {
|
|
15
16
|
#node;
|
|
16
17
|
constructor(node) {
|
|
@@ -38,7 +39,7 @@ class ColumnDefinitionBuilder {
|
|
|
38
39
|
throw new Error('on delete constraint can only be added for foreign keys');
|
|
39
40
|
}
|
|
40
41
|
return new ColumnDefinitionBuilder(column_definition_node_js_1.ColumnDefinitionNode.cloneWith(this.#node, {
|
|
41
|
-
references: references_node_js_1.ReferencesNode.cloneWithOnDelete(this.#node.references, onDelete),
|
|
42
|
+
references: references_node_js_1.ReferencesNode.cloneWithOnDelete(this.#node.references, (0, on_modify_action_parser_js_1.parseOnModifyForeignAction)(onDelete)),
|
|
42
43
|
}));
|
|
43
44
|
}
|
|
44
45
|
onUpdate(onUpdate) {
|
|
@@ -46,7 +47,7 @@ class ColumnDefinitionBuilder {
|
|
|
46
47
|
throw new Error('on update constraint can only be added for foreign keys');
|
|
47
48
|
}
|
|
48
49
|
return new ColumnDefinitionBuilder(column_definition_node_js_1.ColumnDefinitionNode.cloneWith(this.#node, {
|
|
49
|
-
references: references_node_js_1.ReferencesNode.cloneWithOnUpdate(this.#node.references, onUpdate),
|
|
50
|
+
references: references_node_js_1.ReferencesNode.cloneWithOnUpdate(this.#node.references, (0, on_modify_action_parser_js_1.parseOnModifyForeignAction)(onUpdate)),
|
|
50
51
|
}));
|
|
51
52
|
}
|
|
52
53
|
unique() {
|
|
@@ -14,6 +14,7 @@ const primary_constraint_node_js_1 = require("../operation-node/primary-constrai
|
|
|
14
14
|
const unique_constraint_node_js_1 = require("../operation-node/unique-constraint-node.js");
|
|
15
15
|
const check_constraint_node_js_1 = require("../operation-node/check-constraint-node.js");
|
|
16
16
|
const table_parser_js_1 = require("../parser/table-parser.js");
|
|
17
|
+
const on_commit_action_parse_js_1 = require("../parser/on-commit-action-parse.js");
|
|
17
18
|
/**
|
|
18
19
|
* This builder can be used to create a `create table` query.
|
|
19
20
|
*/
|
|
@@ -45,7 +46,7 @@ class CreateTableBuilder {
|
|
|
45
46
|
return new CreateTableBuilder({
|
|
46
47
|
...this.#props,
|
|
47
48
|
createTableNode: create_table_node_js_1.CreateTableNode.cloneWith(this.#props.createTableNode, {
|
|
48
|
-
onCommit,
|
|
49
|
+
onCommit: (0, on_commit_action_parse_js_1.parseOnCommitAction)(onCommit),
|
|
49
50
|
}),
|
|
50
51
|
});
|
|
51
52
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ForeignKeyConstraintBuilder = void 0;
|
|
4
4
|
const foreign_key_constraint_node_js_1 = require("../operation-node/foreign-key-constraint-node.js");
|
|
5
|
+
const on_modify_action_parser_js_1 = require("../parser/on-modify-action-parser.js");
|
|
5
6
|
const prevent_await_js_1 = require("../util/prevent-await.js");
|
|
6
7
|
class ForeignKeyConstraintBuilder {
|
|
7
8
|
#node;
|
|
@@ -10,12 +11,12 @@ class ForeignKeyConstraintBuilder {
|
|
|
10
11
|
}
|
|
11
12
|
onDelete(onDelete) {
|
|
12
13
|
return new ForeignKeyConstraintBuilder(foreign_key_constraint_node_js_1.ForeignKeyConstraintNode.cloneWith(this.#node, {
|
|
13
|
-
onDelete,
|
|
14
|
+
onDelete: (0, on_modify_action_parser_js_1.parseOnModifyForeignAction)(onDelete),
|
|
14
15
|
}));
|
|
15
16
|
}
|
|
16
17
|
onUpdate(onUpdate) {
|
|
17
18
|
return new ForeignKeyConstraintBuilder(foreign_key_constraint_node_js_1.ForeignKeyConstraintNode.cloneWith(this.#node, {
|
|
18
|
-
onUpdate,
|
|
19
|
+
onUpdate: (0, on_modify_action_parser_js_1.parseOnModifyForeignAction)(onUpdate),
|
|
19
20
|
}));
|
|
20
21
|
}
|
|
21
22
|
toOperationNode() {
|
|
@@ -2,7 +2,9 @@ import { OperationNode } from './operation-node.js';
|
|
|
2
2
|
import { TableNode } from './table-node.js';
|
|
3
3
|
import { ConstraintNode } from './constraint-node.js';
|
|
4
4
|
import { ColumnDefinitionNode } from './column-definition-node.js';
|
|
5
|
-
|
|
5
|
+
import { ArrayItemType } from '../util/type-utils.js';
|
|
6
|
+
export declare const ON_COMMIT_ACTIONS: string[];
|
|
7
|
+
export declare type OnCommitAction = ArrayItemType<typeof ON_COMMIT_ACTIONS>;
|
|
6
8
|
export declare type CreateTableNodeParams = Omit<CreateTableNode, 'kind' | 'table' | 'columns' | 'constraints'>;
|
|
7
9
|
export interface CreateTableNode extends OperationNode {
|
|
8
10
|
readonly kind: 'CreateTableNode';
|
|
@@ -20,8 +20,8 @@ export declare const ForeignKeyConstraintNode: Readonly<{
|
|
|
20
20
|
create(sourceColumns: ReadonlyArray<ColumnNode>, targetTable: TableNode, targetColumns: ReadonlyArray<ColumnNode>, constraintName?: string): ForeignKeyConstraintNode;
|
|
21
21
|
cloneWith(node: ForeignKeyConstraintNode, props: ForeignKeyConstraintNodeProps): Readonly<{
|
|
22
22
|
name?: IdentifierNode | undefined;
|
|
23
|
-
onDelete?:
|
|
24
|
-
onUpdate?:
|
|
23
|
+
onDelete?: "no action" | "restrict" | "cascade" | "set null" | "set default" | undefined;
|
|
24
|
+
onUpdate?: "no action" | "restrict" | "cascade" | "set null" | "set default" | undefined;
|
|
25
25
|
kind: 'ForeignKeyConstraintNode';
|
|
26
26
|
columns: ReadonlyArray<ColumnNode>;
|
|
27
27
|
references: ReferencesNode;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { OperationNode } from './operation-node.js';
|
|
2
2
|
import { ColumnNode } from './column-node.js';
|
|
3
3
|
import { TableNode } from './table-node.js';
|
|
4
|
-
|
|
4
|
+
import { ArrayItemType } from '../util/type-utils.js';
|
|
5
|
+
export declare const ON_MODIFY_FOREIGN_ACTIONS: readonly ["no action", "restrict", "cascade", "set null", "set default"];
|
|
6
|
+
export declare type OnModifyForeignAction = ArrayItemType<typeof ON_MODIFY_FOREIGN_ACTIONS>;
|
|
5
7
|
export interface ReferencesNode extends OperationNode {
|
|
6
8
|
readonly kind: 'ReferencesNode';
|
|
7
9
|
readonly table: TableNode;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="./on-commit-action-parse.d.ts" />
|
|
2
|
+
import { ON_COMMIT_ACTIONS, } from '../operation-node/create-table-node.js';
|
|
3
|
+
export function parseOnCommitAction(action) {
|
|
4
|
+
if (ON_COMMIT_ACTIONS.includes(action)) {
|
|
5
|
+
return action;
|
|
6
|
+
}
|
|
7
|
+
throw new Error(`invalid OnCommitAction ${action}`);
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="./on-modify-action-parser.d.ts" />
|
|
2
|
+
import { ON_MODIFY_FOREIGN_ACTIONS, } from '../operation-node/references-node.js';
|
|
3
|
+
export function parseOnModifyForeignAction(action) {
|
|
4
|
+
if (ON_MODIFY_FOREIGN_ACTIONS.includes(action)) {
|
|
5
|
+
return action;
|
|
6
|
+
}
|
|
7
|
+
throw new Error(`invalid OnModifyForeignAction ${action}`);
|
|
8
|
+
}
|
|
@@ -154,6 +154,7 @@ export declare class DefaultQueryCompiler extends OperationNodeVisitor implement
|
|
|
154
154
|
protected getLeftIdentifierWrapper(): string;
|
|
155
155
|
protected getRightIdentifierWrapper(): string;
|
|
156
156
|
protected getCurrentParameterPlaceholder(): string;
|
|
157
|
+
protected sanitizeIdentifier(identifier: string): string;
|
|
157
158
|
protected addParameter(parameter: unknown): void;
|
|
158
159
|
protected appendImmediateValue(value: unknown): void;
|
|
159
160
|
}
|
|
@@ -225,7 +225,7 @@ export class DefaultQueryCompiler extends OperationNodeVisitor {
|
|
|
225
225
|
this.append(this.getRightIdentifierWrapper());
|
|
226
226
|
}
|
|
227
227
|
compileUnwrappedIdentifier(node) {
|
|
228
|
-
this.append(node.identifier);
|
|
228
|
+
this.append(this.sanitizeIdentifier(node.identifier));
|
|
229
229
|
}
|
|
230
230
|
visitFilter(node) {
|
|
231
231
|
if (node.left) {
|
|
@@ -820,6 +820,24 @@ export class DefaultQueryCompiler extends OperationNodeVisitor {
|
|
|
820
820
|
getCurrentParameterPlaceholder() {
|
|
821
821
|
return '$' + this.numParameters;
|
|
822
822
|
}
|
|
823
|
+
sanitizeIdentifier(identifier) {
|
|
824
|
+
if (!isString(identifier)) {
|
|
825
|
+
throw new Error('a non-string identifier was passed to sanitizeIdentifier.');
|
|
826
|
+
}
|
|
827
|
+
const leftWrap = this.getLeftIdentifierWrapper();
|
|
828
|
+
const rightWrap = this.getRightIdentifierWrapper();
|
|
829
|
+
let sanitized = '';
|
|
830
|
+
for (const c of identifier) {
|
|
831
|
+
sanitized += c;
|
|
832
|
+
if (c === leftWrap) {
|
|
833
|
+
sanitized += leftWrap;
|
|
834
|
+
}
|
|
835
|
+
else if (c === rightWrap) {
|
|
836
|
+
sanitized += rightWrap;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
return sanitized;
|
|
840
|
+
}
|
|
823
841
|
addParameter(parameter) {
|
|
824
842
|
this.#parameters.push(parameter);
|
|
825
843
|
}
|
|
@@ -9,6 +9,7 @@ import { ColumnDefinitionNode } from '../operation-node/column-definition-node.j
|
|
|
9
9
|
import { parseDefaultValueExpression, } from '../parser/default-value-parser.js';
|
|
10
10
|
import { GeneratedNode } from '../operation-node/generated-node.js';
|
|
11
11
|
import { DefaultValueNode } from '../operation-node/default-value-node.js';
|
|
12
|
+
import { parseOnModifyForeignAction } from '../parser/on-modify-action-parser.js';
|
|
12
13
|
export class ColumnDefinitionBuilder {
|
|
13
14
|
#node;
|
|
14
15
|
constructor(node) {
|
|
@@ -36,7 +37,7 @@ export class ColumnDefinitionBuilder {
|
|
|
36
37
|
throw new Error('on delete constraint can only be added for foreign keys');
|
|
37
38
|
}
|
|
38
39
|
return new ColumnDefinitionBuilder(ColumnDefinitionNode.cloneWith(this.#node, {
|
|
39
|
-
references: ReferencesNode.cloneWithOnDelete(this.#node.references, onDelete),
|
|
40
|
+
references: ReferencesNode.cloneWithOnDelete(this.#node.references, parseOnModifyForeignAction(onDelete)),
|
|
40
41
|
}));
|
|
41
42
|
}
|
|
42
43
|
onUpdate(onUpdate) {
|
|
@@ -44,7 +45,7 @@ export class ColumnDefinitionBuilder {
|
|
|
44
45
|
throw new Error('on update constraint can only be added for foreign keys');
|
|
45
46
|
}
|
|
46
47
|
return new ColumnDefinitionBuilder(ColumnDefinitionNode.cloneWith(this.#node, {
|
|
47
|
-
references: ReferencesNode.cloneWithOnUpdate(this.#node.references, onUpdate),
|
|
48
|
+
references: ReferencesNode.cloneWithOnUpdate(this.#node.references, parseOnModifyForeignAction(onUpdate)),
|
|
48
49
|
}));
|
|
49
50
|
}
|
|
50
51
|
unique() {
|
|
@@ -12,6 +12,7 @@ import { PrimaryConstraintNode } from '../operation-node/primary-constraint-node
|
|
|
12
12
|
import { UniqueConstraintNode } from '../operation-node/unique-constraint-node.js';
|
|
13
13
|
import { CheckConstraintNode } from '../operation-node/check-constraint-node.js';
|
|
14
14
|
import { parseTable } from '../parser/table-parser.js';
|
|
15
|
+
import { parseOnCommitAction } from '../parser/on-commit-action-parse.js';
|
|
15
16
|
/**
|
|
16
17
|
* This builder can be used to create a `create table` query.
|
|
17
18
|
*/
|
|
@@ -43,7 +44,7 @@ export class CreateTableBuilder {
|
|
|
43
44
|
return new CreateTableBuilder({
|
|
44
45
|
...this.#props,
|
|
45
46
|
createTableNode: CreateTableNode.cloneWith(this.#props.createTableNode, {
|
|
46
|
-
onCommit,
|
|
47
|
+
onCommit: parseOnCommitAction(onCommit),
|
|
47
48
|
}),
|
|
48
49
|
});
|
|
49
50
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="./foreign-key-constraint-builder.d.ts" />
|
|
2
2
|
import { ForeignKeyConstraintNode } from '../operation-node/foreign-key-constraint-node.js';
|
|
3
|
+
import { parseOnModifyForeignAction } from '../parser/on-modify-action-parser.js';
|
|
3
4
|
import { preventAwait } from '../util/prevent-await.js';
|
|
4
5
|
export class ForeignKeyConstraintBuilder {
|
|
5
6
|
#node;
|
|
@@ -8,12 +9,12 @@ export class ForeignKeyConstraintBuilder {
|
|
|
8
9
|
}
|
|
9
10
|
onDelete(onDelete) {
|
|
10
11
|
return new ForeignKeyConstraintBuilder(ForeignKeyConstraintNode.cloneWith(this.#node, {
|
|
11
|
-
onDelete,
|
|
12
|
+
onDelete: parseOnModifyForeignAction(onDelete),
|
|
12
13
|
}));
|
|
13
14
|
}
|
|
14
15
|
onUpdate(onUpdate) {
|
|
15
16
|
return new ForeignKeyConstraintBuilder(ForeignKeyConstraintNode.cloneWith(this.#node, {
|
|
16
|
-
onUpdate,
|
|
17
|
+
onUpdate: parseOnModifyForeignAction(onUpdate),
|
|
17
18
|
}));
|
|
18
19
|
}
|
|
19
20
|
toOperationNode() {
|