@ignisia/sql 0.2.0 → 0.2.1

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.
Files changed (46) hide show
  1. package/dist/column/constants.js +97 -8
  2. package/dist/column/index.js +105 -8
  3. package/dist/column/types.js +1 -2
  4. package/dist/database/alter.js +87 -15
  5. package/dist/database/column.js +33 -11
  6. package/dist/database/contract.js +1 -0
  7. package/dist/database/index.js +92 -19
  8. package/dist/database/table.js +37 -19
  9. package/dist/database/types.js +1 -0
  10. package/dist/database/wrapper.js +92 -9
  11. package/dist/index.js +5 -32
  12. package/dist/migration/index.js +48 -6
  13. package/dist/migration/runner.js +7 -20
  14. package/dist/migration/type.js +1 -0
  15. package/dist/query/builder.js +66 -16
  16. package/dist/query/condition.js +97 -24
  17. package/dist/query/constants.js +54 -19
  18. package/dist/query/contract.js +1 -0
  19. package/dist/query/helper.js +30 -18
  20. package/dist/query/index.js +195 -10
  21. package/dist/query/join.js +16 -6
  22. package/dist/query/sql.js +99 -16
  23. package/dist/query/types.js +1 -0
  24. package/dist/query/utilities.js +175 -24
  25. package/dist/table/constants.js +5 -5
  26. package/dist/table/index.js +52 -14
  27. package/dist/table/types.js +1 -0
  28. package/dist/table/utilities.js +50 -15
  29. package/dist/types.js +1 -0
  30. package/dist/utilities.js +18 -8
  31. package/package.json +37 -2
  32. package/dist/chunk-62FKD35V.js +0 -65
  33. package/dist/chunk-CIWX3UCZ.js +0 -51
  34. package/dist/chunk-EIUC7HJS.js +0 -686
  35. package/dist/chunk-FYSNJAGD.js +0 -19
  36. package/dist/chunk-G3LSCLIQ.js +0 -104
  37. package/dist/chunk-GLOHF5CP.js +0 -9
  38. package/dist/chunk-GY7R637S.js +0 -113
  39. package/dist/chunk-HKTHKQLK.js +0 -98
  40. package/dist/chunk-JF7OSNH4.js +0 -40
  41. package/dist/chunk-KVCIOW7L.js +0 -59
  42. package/dist/chunk-OYM2PNYZ.js +0 -44
  43. package/dist/chunk-UI7U54OT.js +0 -112
  44. package/dist/chunk-V4OMHVJN.js +0 -96
  45. package/dist/chunk-WVJGTZFI.js +0 -60
  46. package/dist/chunk-Y7FSRHH3.js +0 -22
@@ -1,104 +0,0 @@
1
- import {
2
- Dialect
3
- } from "./chunk-GLOHF5CP.js";
4
-
5
- // src/column/constants.ts
6
- var AcceptedColumnTypes = {
7
- INTEGER: "INTEGER",
8
- STRING: "STRING",
9
- BOOLEAN: "BOOLEAN",
10
- DATE: "DATE",
11
- FLOAT: "FLOAT",
12
- DECIMAL: "DECIMAL",
13
- BIGINT: "BIGINT",
14
- TEXT: "TEXT",
15
- BLOB: "BLOB",
16
- JSON: "JSON",
17
- VARCHAR: "VARCHAR",
18
- TIME: "TIME",
19
- TIMESTAMP: "TIMESTAMP",
20
- DOUBLE: "DOUBLE",
21
- DATETIME: "DATETIME",
22
- DATEONLY: "DATEONLY",
23
- ENUM: "ENUM",
24
- SERIAL: "SERIAL"
25
- };
26
- var ColumnTypeMapping = {
27
- [AcceptedColumnTypes.INTEGER]: {
28
- [Dialect.SQLITE]: "INTEGER",
29
- [Dialect.POSTGRES]: "INTEGER"
30
- },
31
- [AcceptedColumnTypes.STRING]: {
32
- [Dialect.SQLITE]: "TEXT",
33
- [Dialect.POSTGRES]: "VARCHAR"
34
- },
35
- [AcceptedColumnTypes.BOOLEAN]: {
36
- [Dialect.SQLITE]: "INTEGER",
37
- [Dialect.POSTGRES]: "BOOLEAN"
38
- },
39
- [AcceptedColumnTypes.DATE]: {
40
- [Dialect.SQLITE]: "TEXT",
41
- [Dialect.POSTGRES]: "DATE"
42
- },
43
- [AcceptedColumnTypes.FLOAT]: {
44
- [Dialect.SQLITE]: "REAL",
45
- [Dialect.POSTGRES]: "FLOAT"
46
- },
47
- [AcceptedColumnTypes.DECIMAL]: {
48
- [Dialect.SQLITE]: "TEXT",
49
- [Dialect.POSTGRES]: "DECIMAL"
50
- },
51
- [AcceptedColumnTypes.BIGINT]: {
52
- [Dialect.SQLITE]: "TEXT",
53
- [Dialect.POSTGRES]: "BIGINT"
54
- },
55
- [AcceptedColumnTypes.TEXT]: {
56
- [Dialect.SQLITE]: "TEXT",
57
- [Dialect.POSTGRES]: "TEXT"
58
- },
59
- [AcceptedColumnTypes.BLOB]: {
60
- [Dialect.SQLITE]: "BLOB",
61
- [Dialect.POSTGRES]: "BYTEA"
62
- },
63
- [AcceptedColumnTypes.JSON]: {
64
- [Dialect.SQLITE]: "TEXT",
65
- [Dialect.POSTGRES]: "JSONB"
66
- },
67
- [AcceptedColumnTypes.VARCHAR]: {
68
- [Dialect.SQLITE]: "TEXT",
69
- [Dialect.POSTGRES]: "VARCHAR"
70
- },
71
- [AcceptedColumnTypes.TIME]: {
72
- [Dialect.SQLITE]: "TEXT",
73
- [Dialect.POSTGRES]: "TIME"
74
- },
75
- [AcceptedColumnTypes.TIMESTAMP]: {
76
- [Dialect.SQLITE]: "TEXT",
77
- [Dialect.POSTGRES]: "TIMESTAMP"
78
- },
79
- [AcceptedColumnTypes.DOUBLE]: {
80
- [Dialect.SQLITE]: "REAL",
81
- [Dialect.POSTGRES]: "DOUBLE PRECISION"
82
- },
83
- [AcceptedColumnTypes.DATETIME]: {
84
- [Dialect.SQLITE]: "TEXT",
85
- [Dialect.POSTGRES]: "TIMESTAMP"
86
- },
87
- [AcceptedColumnTypes.DATEONLY]: {
88
- [Dialect.SQLITE]: "TEXT",
89
- [Dialect.POSTGRES]: "DATE"
90
- },
91
- [AcceptedColumnTypes.ENUM]: {
92
- [Dialect.SQLITE]: "TEXT",
93
- [Dialect.POSTGRES]: "TEXT"
94
- },
95
- [AcceptedColumnTypes.SERIAL]: {
96
- [Dialect.SQLITE]: "INTEGER AUTOINCREMENT",
97
- [Dialect.POSTGRES]: "SERIAL"
98
- }
99
- };
100
-
101
- export {
102
- AcceptedColumnTypes,
103
- ColumnTypeMapping
104
- };
@@ -1,9 +0,0 @@
1
- // src/table/constants.ts
2
- var Dialect = {
3
- POSTGRES: "postgres",
4
- SQLITE: "sqlite"
5
- };
6
-
7
- export {
8
- Dialect
9
- };
@@ -1,113 +0,0 @@
1
- import {
2
- AcceptedColumnTypes,
3
- ColumnTypeMapping
4
- } from "./chunk-G3LSCLIQ.js";
5
- import {
6
- Dialect
7
- } from "./chunk-GLOHF5CP.js";
8
-
9
- // src/column/index.ts
10
- var Column = class _Column {
11
- definition;
12
- type;
13
- length;
14
- enums;
15
- _output;
16
- constructor(options) {
17
- this.type = options.type;
18
- this.enums = [];
19
- this.length = null;
20
- if ("length" in options) {
21
- this.length = options.length;
22
- }
23
- if ("values" in options) {
24
- this.enums = options.values;
25
- }
26
- this.definition = {
27
- autoIncrement: false,
28
- primaryKey: false,
29
- notNull: false,
30
- unique: false,
31
- comment: null,
32
- default: void 0
33
- };
34
- }
35
- static define(options) {
36
- return new _Column(options);
37
- }
38
- autoIncrement() {
39
- this.definition.autoIncrement = true;
40
- return this;
41
- }
42
- primaryKey() {
43
- this.definition.primaryKey = true;
44
- return this;
45
- }
46
- notNull() {
47
- this.definition.notNull = true;
48
- return this;
49
- }
50
- unique() {
51
- this.definition.unique = true;
52
- return this;
53
- }
54
- comment(value) {
55
- this.definition.comment = value;
56
- return this;
57
- }
58
- default(value) {
59
- this.definition.default = value;
60
- return this;
61
- }
62
- dialect(dialect) {
63
- this.definition.dialect = dialect;
64
- return this;
65
- }
66
- toQuery() {
67
- if (!this.definition.dialect) {
68
- throw new Error("No DB Dialect defined");
69
- }
70
- const correctType = ColumnTypeMapping[this.type][this.definition.dialect];
71
- let sql = correctType + (this.length ? `(${this.length})` : "");
72
- if (this.definition.primaryKey) {
73
- sql += " PRIMARY KEY";
74
- }
75
- if (this.definition.autoIncrement || this.type === AcceptedColumnTypes.SERIAL) {
76
- const isPrimaryKey = !!this.definition.primaryKey;
77
- if (this.definition.dialect === Dialect.POSTGRES) {
78
- sql = `SERIAL${isPrimaryKey ? " PRIMARY KEY" : ""}`;
79
- } else {
80
- if (this.type !== AcceptedColumnTypes.SERIAL) {
81
- sql += " AUTOINCREMENT";
82
- } else {
83
- const sqls = ["INTEGER", "PRIMARY KEY", "AUTOINCREMENT"];
84
- if (!isPrimaryKey) sqls.splice(1, 1);
85
- sql = sqls.join(" ");
86
- }
87
- }
88
- }
89
- if (this.definition.notNull) {
90
- sql += " NOT NULL";
91
- }
92
- if (this.definition.unique) {
93
- sql += " UNIQUE";
94
- }
95
- if (this.definition.default !== void 0) {
96
- const value = this.definition.default;
97
- const isString = typeof this.definition.default === "string";
98
- const finalValue = isString ? `'${value}'` : value;
99
- sql += ` DEFAULT ${finalValue}`;
100
- }
101
- return { query: sql, params: [] };
102
- }
103
- toString() {
104
- return this.toQuery().query;
105
- }
106
- infer() {
107
- return null;
108
- }
109
- };
110
-
111
- export {
112
- Column
113
- };
@@ -1,98 +0,0 @@
1
- import {
2
- Dialect
3
- } from "./chunk-GLOHF5CP.js";
4
-
5
- // src/database/wrapper.ts
6
- import { SQL } from "bun";
7
- import { Database as Sqlite } from "bun:sqlite";
8
- var DatabasePsql = class {
9
- dialect;
10
- options;
11
- client;
12
- status;
13
- constructor(options) {
14
- this.dialect = Dialect.POSTGRES;
15
- this.options = options;
16
- this.status = "connecting";
17
- this.client = new SQL({
18
- ...options,
19
- onconnect: () => {
20
- this.status = "connected";
21
- },
22
- onclose: () => {
23
- this.status = "disconnected";
24
- }
25
- });
26
- this.connect();
27
- }
28
- async connect() {
29
- await this.client.connect();
30
- return this;
31
- }
32
- async disconnect() {
33
- await this.client.close();
34
- return this;
35
- }
36
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
- async exec(sql, values) {
38
- if (!values) {
39
- return this.client.unsafe(sql);
40
- }
41
- return this.client.unsafe(sql, values);
42
- }
43
- async transaction(fn) {
44
- try {
45
- await this.exec("BEGIN");
46
- const result = await fn();
47
- await this.exec("COMMIT");
48
- return result;
49
- } catch (err) {
50
- await this.exec("ROLLBACK");
51
- throw err;
52
- }
53
- }
54
- };
55
- var DatabaseSqlite = class {
56
- dialect;
57
- options;
58
- client;
59
- status;
60
- constructor(options) {
61
- this.dialect = Dialect.SQLITE;
62
- this.options = options;
63
- this.status = "connecting";
64
- this.client = new Sqlite(options.filename);
65
- this.status = "connected";
66
- }
67
- async connect() {
68
- this.client = new Sqlite(this.options.filename);
69
- this.status = "connected";
70
- return this;
71
- }
72
- async disconnect() {
73
- this.client.close();
74
- this.status = "disconnected";
75
- return this;
76
- }
77
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
78
- async exec(sql, params) {
79
- const query = this.client.prepare(sql, params);
80
- return query.all();
81
- }
82
- async transaction(fn) {
83
- try {
84
- await this.exec("BEGIN");
85
- const result = await fn();
86
- await this.exec("COMMIT");
87
- return result;
88
- } catch (err) {
89
- await this.exec("ROLLBACK");
90
- throw err;
91
- }
92
- }
93
- };
94
-
95
- export {
96
- DatabasePsql,
97
- DatabaseSqlite
98
- };
@@ -1,40 +0,0 @@
1
- import {
2
- Dialect
3
- } from "./chunk-GLOHF5CP.js";
4
-
5
- // src/database/column.ts
6
- async function addColumn(tableName, columnName, column) {
7
- await this.client.exec(
8
- `ALTER TABLE ${tableName} ADD COLUMN ${columnName} ${column.toString()};`
9
- );
10
- if (!this.tables[tableName]) return this;
11
- this.tables[tableName].columns[columnName] = column;
12
- return this;
13
- }
14
- async function renameColumn(tableName, oldName, newName) {
15
- if (this.dialect === Dialect.SQLITE) {
16
- throw new Error("SQLite does not support RENAME COLUMN natively.");
17
- }
18
- await this.client.exec(
19
- `ALTER TABLE ${tableName} RENAME COLUMN ${oldName} TO ${newName};`
20
- );
21
- if (!this.tables[tableName]) return this;
22
- this.tables[tableName].columns[newName] = this.tables[tableName].columns[oldName];
23
- delete this.tables[tableName].columns[oldName];
24
- return this;
25
- }
26
- async function dropColumn(tableName, columnName) {
27
- if (this.dialect === Dialect.SQLITE) {
28
- throw new Error("SQLite does not support DROP COLUMN natively.");
29
- }
30
- await this.client.exec(`ALTER TABLE ${tableName} DROP COLUMN ${columnName};`);
31
- if (!this.tables[tableName]) return this;
32
- delete this.tables[tableName].columns[columnName];
33
- return this;
34
- }
35
-
36
- export {
37
- addColumn,
38
- renameColumn,
39
- dropColumn
40
- };
@@ -1,59 +0,0 @@
1
- import {
2
- QueryBuilder
3
- } from "./chunk-EIUC7HJS.js";
4
- import {
5
- defineColumns
6
- } from "./chunk-WVJGTZFI.js";
7
-
8
- // src/table/index.ts
9
- var Table = class _Table {
10
- client;
11
- dialect;
12
- name;
13
- columns;
14
- timestamp;
15
- paranoid;
16
- _output;
17
- constructor(options) {
18
- this.dialect = options.dialect;
19
- this.name = options.name;
20
- this.columns = options.columns;
21
- this.paranoid = options.paranoid || null;
22
- this.timestamp = options.timestamp || null;
23
- this.client = null;
24
- for (const column of Object.values(this.columns)) {
25
- column.dialect(options.dialect);
26
- }
27
- }
28
- infer() {
29
- return null;
30
- }
31
- static define(options) {
32
- const columns = defineColumns(options);
33
- return new _Table({
34
- ...options,
35
- columns
36
- });
37
- }
38
- async create(db = this.client) {
39
- if (!db) throw new Error("Database client not defined");
40
- const sql = `CREATE TABLE IF NOT EXISTS ${this.name} (${Object.entries(
41
- this.columns
42
- ).map(([name, column]) => `${name} ${column.toQuery().query}`).join(", ")});`;
43
- await db.exec(sql);
44
- return this;
45
- }
46
- async drop(db = this.client) {
47
- if (!db) throw new Error("Database client not defined");
48
- const sql = `DROP TABLE IF EXISTS ${this.name};`;
49
- await db.exec(sql);
50
- return this;
51
- }
52
- query() {
53
- return new QueryBuilder(this);
54
- }
55
- };
56
-
57
- export {
58
- Table
59
- };
@@ -1,44 +0,0 @@
1
- import {
2
- Table
3
- } from "./chunk-KVCIOW7L.js";
4
-
5
- // src/database/table.ts
6
- async function createTable(tableName, columns, options) {
7
- const table = Table.define({
8
- name: tableName,
9
- dialect: this.dialect,
10
- columns,
11
- ...options
12
- });
13
- table.client = this.client;
14
- this.tables[tableName] = table;
15
- if (!this?.client) {
16
- throw new Error("Database not connected");
17
- }
18
- while (this.client.status === "connecting") {
19
- await new Promise((resolve) => setTimeout(resolve, 100));
20
- }
21
- await table.create(this.client);
22
- return this;
23
- }
24
- async function renameTable(oldName, newName) {
25
- await this.client.exec(`ALTER TABLE ${oldName} RENAME TO ${newName};`);
26
- this.tables[newName] = this.tables[oldName];
27
- delete this.tables[oldName];
28
- return this;
29
- }
30
- async function dropTable(tableName) {
31
- if (!this.tables[tableName]) {
32
- await this.client.exec(`DROP TABLE IF EXISTS ${tableName};`);
33
- return this;
34
- }
35
- await this.tables[tableName].drop(this.client);
36
- delete this.tables[tableName];
37
- return this;
38
- }
39
-
40
- export {
41
- createTable,
42
- renameTable,
43
- dropTable
44
- };
@@ -1,112 +0,0 @@
1
- import {
2
- DatabasePsql,
3
- DatabaseSqlite
4
- } from "./chunk-HKTHKQLK.js";
5
- import {
6
- addColumn,
7
- dropColumn,
8
- renameColumn
9
- } from "./chunk-JF7OSNH4.js";
10
- import {
11
- createTable,
12
- dropTable,
13
- renameTable
14
- } from "./chunk-OYM2PNYZ.js";
15
- import {
16
- alterColumnType,
17
- dropColumnDefault,
18
- dropColumnNotNull,
19
- setColumnDefault
20
- } from "./chunk-V4OMHVJN.js";
21
- import {
22
- Dialect
23
- } from "./chunk-GLOHF5CP.js";
24
-
25
- // src/database/index.ts
26
- var Database = class _Database {
27
- hooks;
28
- dialect;
29
- defintion;
30
- tables;
31
- client;
32
- createTable;
33
- renameTable;
34
- dropTable;
35
- addColumn;
36
- renameColumn;
37
- dropColumn;
38
- alterColumnType;
39
- setColumnDefault;
40
- dropColumnDefault;
41
- setColumnNotNull;
42
- dropColumnNotNull;
43
- constructor(options) {
44
- this.hooks = {};
45
- this.dialect = options.dialect;
46
- this.tables = options.tables ?? {};
47
- this.defintion = {
48
- dialect: options.dialect,
49
- config: options.config
50
- };
51
- this.client = options.dialect === Dialect.POSTGRES ? new DatabasePsql(options.config) : new DatabaseSqlite(options.config);
52
- if (options.tables) {
53
- for (const tableName in options.tables) {
54
- options.tables[tableName].client = this.client;
55
- }
56
- }
57
- this.createTable = createTable.bind(this);
58
- this.renameTable = renameTable.bind(this);
59
- this.dropTable = dropTable.bind(this);
60
- this.addColumn = addColumn.bind(this);
61
- this.renameColumn = renameColumn.bind(this);
62
- this.dropColumn = dropColumn.bind(this);
63
- this.alterColumnType = alterColumnType.bind(
64
- this
65
- );
66
- this.setColumnDefault = setColumnDefault.bind(
67
- this
68
- );
69
- this.dropColumnDefault = dropColumnDefault.bind(
70
- this
71
- );
72
- this.setColumnNotNull = setColumnDefault.bind(
73
- this
74
- );
75
- this.dropColumnNotNull = dropColumnNotNull.bind(
76
- this
77
- );
78
- }
79
- table(tableName) {
80
- if (!this.tables[tableName]) {
81
- throw new Error(`Table ${tableName} does not exist`);
82
- }
83
- const table = this.tables[tableName];
84
- const query = table.query();
85
- query.hooks.before = this.hooks.before;
86
- query.hooks.after = this.hooks.after;
87
- return query;
88
- }
89
- addHook(type, fn) {
90
- if (!this.hooks[type]) {
91
- this.hooks[type] = /* @__PURE__ */ new Set();
92
- }
93
- this.hooks[type].add(fn);
94
- return this;
95
- }
96
- removeHook(type, fn) {
97
- if (this.hooks[type]) {
98
- this.hooks[type].delete(fn);
99
- }
100
- return this;
101
- }
102
- async transaction(fn) {
103
- return this.client.transaction(fn);
104
- }
105
- static define(options) {
106
- return new _Database(options);
107
- }
108
- };
109
-
110
- export {
111
- Database
112
- };
@@ -1,96 +0,0 @@
1
- import {
2
- Dialect
3
- } from "./chunk-GLOHF5CP.js";
4
-
5
- // src/database/alter.ts
6
- async function alterColumnType(tableName, columnName, newType) {
7
- if (this.dialect === Dialect.SQLITE) {
8
- throw new Error("SQLite does not support ALTER COLUMN TYPE directly.");
9
- }
10
- await this.client.exec(
11
- `ALTER TABLE ${tableName} ALTER COLUMN ${columnName} TYPE ${newType}`
12
- );
13
- if (!this.tables[tableName]) return this;
14
- this.tables[tableName].columns[columnName].type = newType;
15
- return this;
16
- }
17
- async function setColumnDefault(tableName, columnName, value) {
18
- if (this.dialect === Dialect.SQLITE) {
19
- throw new Error("SQLite does not support ALTER COLUMN DEFAULT directly.");
20
- }
21
- await this.client.exec(
22
- `ALTER TABLE ${tableName} ALTER COLUMN ${columnName} SET DEFAULT ${value}`
23
- );
24
- if (!this.tables[tableName]) return this;
25
- if (
26
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
- !this.tables[tableName].columns[columnName].definition
28
- ) {
29
- this.tables[tableName].columns[columnName].definition = {};
30
- }
31
- this.tables[tableName].columns[columnName].definition.default = value;
32
- return this;
33
- }
34
- async function dropColumnDefault(tableName, columnName) {
35
- if (this.dialect === Dialect.SQLITE) {
36
- throw new Error("SQLite does not support DROP DEFAULT directly.");
37
- }
38
- await this.client.exec(
39
- `ALTER TABLE ${tableName} ALTER COLUMN ${columnName} DROP DEFAULT`
40
- );
41
- if (!this.tables[tableName]) return this;
42
- if (
43
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
44
- !this.tables[tableName].columns[columnName].definition
45
- ) {
46
- this.tables[tableName].columns[columnName].definition = {};
47
- }
48
- delete this.tables[tableName].columns[columnName].definition.default;
49
- return this;
50
- }
51
- async function setColumnNotNull(tableName, columnName) {
52
- if (this.dialect === Dialect.SQLITE) {
53
- throw new Error(
54
- "SQLite does not support SET NOT NULL (requires table rebuild)"
55
- );
56
- }
57
- await this.client.exec(
58
- `ALTER TABLE ${tableName} ALTER COLUMN ${columnName} SET NOT NULL`
59
- );
60
- if (!this.tables[tableName]) return this;
61
- if (
62
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
63
- !this.tables[tableName].columns[columnName].definition
64
- ) {
65
- this.tables[tableName].columns[columnName].definition = {};
66
- }
67
- this.tables[tableName].columns[columnName].definition.notNull = true;
68
- return this;
69
- }
70
- async function dropColumnNotNull(tableName, columnName) {
71
- if (this.dialect === Dialect.SQLITE) {
72
- throw new Error(
73
- "SQLite does not support DROP NOT NULL (requires table rebuild)"
74
- );
75
- }
76
- await this.client.exec(
77
- `ALTER TABLE ${tableName} ALTER COLUMN ${columnName} DROP NOT NULL`
78
- );
79
- if (!this.tables[tableName]) return this;
80
- if (
81
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
82
- !this.tables[tableName].columns[columnName].definition
83
- ) {
84
- this.tables[tableName].columns[columnName].definition = {};
85
- }
86
- this.tables[tableName].columns[columnName].definition.notNull = null;
87
- return this;
88
- }
89
-
90
- export {
91
- alterColumnType,
92
- setColumnDefault,
93
- dropColumnDefault,
94
- setColumnNotNull,
95
- dropColumnNotNull
96
- };