fib-orm 1.4.2 → 2.1.0
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/License +1 -1
- package/README.md +53 -0
- package/lib/cli/commands/ddlFrom.d.ts +2 -0
- package/lib/cli/commands/ddlFrom.js +75 -0
- package/lib/cli/commands/dumpModel.d.ts +2 -0
- package/lib/cli/commands/dumpModel.js +107 -0
- package/lib/cli/commands/escape.d.ts +2 -0
- package/lib/cli/commands/escape.js +69 -0
- package/lib/cli/commands/spinner.d.ts +2 -0
- package/lib/cli/commands/spinner.js +37 -0
- package/lib/cli/commands/upgrade.d.ts +2 -0
- package/lib/cli/commands/upgrade.js +66 -0
- package/lib/cli/helpers/ddl.d.ts +17 -0
- package/lib/cli/helpers/ddl.js +55 -0
- package/lib/cli/helpers/package.d.ts +25 -0
- package/lib/cli/helpers/package.js +56 -0
- package/lib/cli/index.d.ts +2 -0
- package/lib/cli/index.js +19 -0
- package/lib/codepoints-map.json +762 -0
- package/lib/db-driver/Typo.d.ts +111 -0
- package/lib/db-driver/Typo.js +2 -0
- package/lib/db-driver/built-ins/base.class.d.ts +91 -0
- package/lib/db-driver/built-ins/base.class.js +187 -0
- package/lib/db-driver/built-ins/driver-dm.d.ts +17 -0
- package/lib/db-driver/built-ins/driver-dm.js +54 -0
- package/lib/db-driver/built-ins/driver-mongodb.d.ts +23 -0
- package/lib/db-driver/built-ins/driver-mongodb.js +47 -0
- package/lib/db-driver/built-ins/driver-mysql.d.ts +17 -0
- package/lib/db-driver/built-ins/driver-mysql.js +38 -0
- package/lib/db-driver/built-ins/driver-postgresql.d.ts +21 -0
- package/lib/db-driver/built-ins/driver-postgresql.js +77 -0
- package/lib/db-driver/built-ins/driver-redis.d.ts +11 -0
- package/lib/db-driver/built-ins/driver-redis.js +36 -0
- package/lib/db-driver/built-ins/driver-sqlite.d.ts +16 -0
- package/lib/db-driver/built-ins/driver-sqlite.js +35 -0
- package/lib/db-driver/index.d.ts +3 -0
- package/lib/db-driver/index.js +5 -0
- package/lib/db-driver/utils.d.ts +14 -0
- package/lib/db-driver/utils.js +187 -0
- package/lib/knex/deps/tarn/dist/PendingOperation.d.ts +12 -0
- package/lib/knex/deps/tarn/dist/PendingOperation.js +48 -0
- package/lib/knex/deps/tarn/dist/Pool.d.ts +97 -0
- package/lib/knex/deps/tarn/dist/Pool.js +516 -0
- package/lib/knex/deps/tarn/dist/PromiseInspection.d.ts +16 -0
- package/lib/knex/deps/tarn/dist/PromiseInspection.js +21 -0
- package/lib/knex/deps/tarn/dist/Resource.d.ts +9 -0
- package/lib/knex/deps/tarn/dist/Resource.js +19 -0
- package/lib/knex/deps/tarn/dist/TimeoutError.d.ts +2 -0
- package/lib/knex/deps/tarn/dist/TimeoutError.js +5 -0
- package/lib/knex/deps/tarn/dist/tarn.d.ts +3 -0
- package/lib/knex/deps/tarn/dist/tarn.js +10 -0
- package/lib/knex/deps/tarn/dist/utils.d.ts +14 -0
- package/lib/knex/deps/tarn/dist/utils.js +60 -0
- package/lib/knex/knex.d.ts +2 -0
- package/lib/knex/knex.js +4 -0
- package/lib/knex/sandbox.d.ts +4 -0
- package/lib/knex/sandbox.js +23 -0
- package/lib/orm/Adapters.d.ts +3 -0
- package/lib/orm/Adapters.js +44 -0
- package/lib/orm/AggregateFunctions.d.ts +3 -0
- package/lib/orm/AggregateFunctions.js +177 -0
- package/lib/orm/Associations/Extend.d.ts +22 -0
- package/lib/orm/Associations/Extend.js +274 -0
- package/lib/orm/Associations/Many.d.ts +16 -0
- package/lib/orm/Associations/Many.js +569 -0
- package/lib/orm/Associations/One.d.ts +16 -0
- package/lib/orm/Associations/One.js +310 -0
- package/lib/orm/Associations/_utils.d.ts +14 -0
- package/lib/orm/Associations/_utils.js +53 -0
- package/lib/orm/ChainFind.d.ts +3 -0
- package/lib/orm/ChainFind.js +328 -0
- package/lib/orm/ChainInstance.d.ts +6 -0
- package/lib/orm/ChainInstance.js +74 -0
- package/lib/orm/Debug.d.ts +2 -0
- package/lib/orm/Debug.js +17 -0
- package/lib/orm/Drivers/DB/base.d.ts +2 -0
- package/lib/orm/Drivers/DB/base.js +4 -0
- package/lib/orm/Drivers/DB/dm.d.ts +9 -0
- package/lib/orm/Drivers/DB/dm.js +24 -0
- package/lib/orm/Drivers/DB/mysql.d.ts +9 -0
- package/lib/orm/Drivers/DB/mysql.js +24 -0
- package/lib/orm/Drivers/DB/postgres.d.ts +9 -0
- package/lib/orm/Drivers/DB/postgres.js +23 -0
- package/lib/orm/Drivers/DB/sqlite3.d.ts +14 -0
- package/lib/orm/Drivers/DB/sqlite3.js +40 -0
- package/lib/orm/Drivers/DML/_ddl-sql.d.ts +3 -0
- package/lib/orm/Drivers/DML/_ddl-sql.js +52 -0
- package/lib/orm/Drivers/DML/_dml-helpers.d.ts +19 -0
- package/lib/orm/Drivers/DML/_dml-helpers.js +51 -0
- package/lib/orm/Drivers/DML/_shared.d.ts +9 -0
- package/lib/orm/Drivers/DML/_shared.js +39 -0
- package/lib/orm/Drivers/DML/_utils.d.ts +8 -0
- package/lib/orm/Drivers/DML/_utils.js +67 -0
- package/lib/orm/Drivers/DML/constants.d.ts +3 -0
- package/lib/orm/Drivers/DML/constants.js +3 -0
- package/lib/orm/Drivers/DML/dm.d.ts +2 -0
- package/lib/orm/Drivers/DML/dm.js +294 -0
- package/lib/orm/Drivers/DML/index.d.ts +4 -0
- package/lib/orm/Drivers/DML/index.js +7 -0
- package/lib/orm/Drivers/DML/mysql.d.ts +2 -0
- package/lib/orm/Drivers/DML/mysql.js +252 -0
- package/lib/orm/Drivers/DML/postgres.d.ts +2 -0
- package/lib/orm/Drivers/DML/postgres.js +277 -0
- package/lib/orm/Drivers/DML/sqlite.d.ts +2 -0
- package/lib/orm/Drivers/DML/sqlite.js +267 -0
- package/lib/orm/Error.d.ts +11 -0
- package/lib/orm/Error.js +41 -0
- package/lib/orm/Helpers.d.ts +35 -0
- package/lib/orm/Helpers.js +234 -0
- package/lib/orm/Hook.d.ts +13 -0
- package/lib/orm/Hook.js +100 -0
- package/lib/orm/Instance.d.ts +2 -0
- package/lib/orm/Instance.js +698 -0
- package/lib/orm/LazyLoad.d.ts +4 -0
- package/lib/orm/LazyLoad.js +76 -0
- package/lib/orm/Model.d.ts +6 -0
- package/lib/orm/Model.js +974 -0
- package/lib/orm/ORM.d.ts +37 -0
- package/lib/orm/ORM.js +242 -0
- package/lib/orm/Patch/fib-cache.d.ts +39 -0
- package/lib/orm/Patch/fib-cache.js +2 -0
- package/lib/orm/Patch/plugin.d.ts +4 -0
- package/lib/orm/Patch/plugin.js +14 -0
- package/lib/orm/Property.d.ts +9 -0
- package/lib/orm/Property.js +71 -0
- package/lib/orm/Settings.d.ts +42 -0
- package/lib/orm/Settings.js +120 -0
- package/lib/orm/Singleton.d.ts +5 -0
- package/lib/orm/Singleton.js +73 -0
- package/lib/orm/Typo/Adapter.d.ts +5 -0
- package/lib/orm/Typo/Adapter.js +2 -0
- package/lib/orm/Typo/DMLDriver.d.ts +209 -0
- package/lib/orm/Typo/DMLDriver.js +2 -0
- package/lib/orm/Typo/Db.d.ts +35 -0
- package/lib/orm/Typo/Db.js +2 -0
- package/lib/orm/Typo/Error.d.ts +29 -0
- package/lib/orm/Typo/Error.js +2 -0
- package/lib/orm/Typo/ORM.d.ts +231 -0
- package/lib/orm/Typo/ORM.js +4 -0
- package/lib/orm/Typo/Validators.d.ts +31 -0
- package/lib/orm/Typo/Validators.js +3 -0
- package/lib/orm/Typo/_common.d.ts +37 -0
- package/lib/orm/Typo/_common.js +2 -0
- package/lib/orm/Typo/assoc.d.ts +221 -0
- package/lib/orm/Typo/assoc.js +2 -0
- package/lib/orm/Typo/hook.d.ts +42 -0
- package/lib/orm/Typo/hook.js +2 -0
- package/lib/orm/Typo/instance.d.ts +156 -0
- package/lib/orm/Typo/instance.js +2 -0
- package/lib/orm/Typo/model.d.ts +311 -0
- package/lib/orm/Typo/model.js +7 -0
- package/lib/orm/Typo/patch.d.ts +31 -0
- package/lib/orm/Typo/patch.js +2 -0
- package/lib/orm/Typo/property.d.ts +57 -0
- package/lib/orm/Typo/property.js +2 -0
- package/lib/orm/Typo/query.d.ts +216 -0
- package/lib/orm/Typo/query.js +2 -0
- package/lib/orm/Typo/settings.d.ts +35 -0
- package/lib/orm/Typo/settings.js +6 -0
- package/lib/orm/Typo/synchronous.d.ts +47 -0
- package/lib/orm/Typo/synchronous.js +2 -0
- package/lib/orm/Utilities.d.ts +178 -0
- package/lib/orm/Utilities.js +975 -0
- package/lib/orm/Validators.d.ts +33 -0
- package/lib/orm/Validators.js +101 -0
- package/lib/orm/Where/common.d.ts +1 -0
- package/lib/orm/Where/common.js +7 -0
- package/lib/orm/Where/filterDate.d.ts +11 -0
- package/lib/orm/Where/filterDate.js +58 -0
- package/lib/orm/index.d.ts +67 -0
- package/lib/orm/index.js +158 -0
- package/lib/orm-core/callback.d.ts +12 -0
- package/lib/orm-core/callback.js +2 -0
- package/lib/orm-core/dialect.d.ts +80 -0
- package/lib/orm-core/dialect.js +2 -0
- package/lib/orm-core/error.d.ts +16 -0
- package/lib/orm-core/error.js +29 -0
- package/lib/orm-core/index.d.ts +6 -0
- package/lib/orm-core/index.js +7 -0
- package/lib/orm-core/sync.d.ts +12 -0
- package/lib/orm-core/sync.js +2 -0
- package/lib/orm-core/utils.d.ts +1 -0
- package/lib/orm-core/utils.js +6 -0
- package/lib/orm-property/Property.d.ts +78 -0
- package/lib/orm-property/Property.js +2 -0
- package/lib/orm-property/Utils.d.ts +9 -0
- package/lib/orm-property/Utils.js +13 -0
- package/lib/orm-property/customTypes.d.ts +2 -0
- package/lib/orm-property/customTypes.js +13 -0
- package/lib/orm-property/index.d.ts +10 -0
- package/lib/orm-property/index.js +23 -0
- package/lib/orm-property/transformer.d.ts +5 -0
- package/lib/orm-property/transformer.js +10 -0
- package/lib/orm-property/transformers/dm.d.ts +29 -0
- package/lib/orm-property/transformers/dm.js +238 -0
- package/lib/orm-property/transformers/index.d.ts +4 -0
- package/lib/orm-property/transformers/index.js +6 -0
- package/lib/orm-property/transformers/mysql.d.ts +101 -0
- package/lib/orm-property/transformers/mysql.js +262 -0
- package/lib/orm-property/transformers/postgresql.d.ts +54 -0
- package/lib/orm-property/transformers/postgresql.js +190 -0
- package/lib/orm-property/transformers/sqlite.d.ts +19 -0
- package/lib/orm-property/transformers/sqlite.js +172 -0
- package/lib/sql-ddl-sync/Dialects/dm.d.ts +39 -0
- package/lib/sql-ddl-sync/Dialects/dm.js +297 -0
- package/lib/sql-ddl-sync/Dialects/index.d.ts +6 -0
- package/lib/sql-ddl-sync/Dialects/index.js +8 -0
- package/lib/sql-ddl-sync/Dialects/mysql.d.ts +38 -0
- package/lib/sql-ddl-sync/Dialects/mysql.js +241 -0
- package/lib/sql-ddl-sync/Dialects/postgresql.d.ts +39 -0
- package/lib/sql-ddl-sync/Dialects/postgresql.js +287 -0
- package/lib/sql-ddl-sync/Dialects/sqlite.d.ts +43 -0
- package/lib/sql-ddl-sync/Dialects/sqlite.js +257 -0
- package/lib/sql-ddl-sync/SQL.d.ts +12 -0
- package/lib/sql-ddl-sync/SQL.js +108 -0
- package/lib/sql-ddl-sync/Typo/Collection.d.ts +13 -0
- package/lib/sql-ddl-sync/Typo/Collection.js +2 -0
- package/lib/sql-ddl-sync/Typo/DbIndex.d.ts +13 -0
- package/lib/sql-ddl-sync/Typo/DbIndex.js +2 -0
- package/lib/sql-ddl-sync/Typo/Dialect.d.ts +81 -0
- package/lib/sql-ddl-sync/Typo/Dialect.js +2 -0
- package/lib/sql-ddl-sync/Typo/Driver.d.ts +53 -0
- package/lib/sql-ddl-sync/Typo/Driver.js +2 -0
- package/lib/sql-ddl-sync/Typo/Query.d.ts +7 -0
- package/lib/sql-ddl-sync/Typo/Query.js +2 -0
- package/lib/sql-ddl-sync/Typo/SQL.d.ts +31 -0
- package/lib/sql-ddl-sync/Typo/SQL.js +2 -0
- package/lib/sql-ddl-sync/Typo/_common.d.ts +29 -0
- package/lib/sql-ddl-sync/Typo/_common.js +2 -0
- package/lib/sql-ddl-sync/Utils.d.ts +39 -0
- package/lib/sql-ddl-sync/Utils.js +217 -0
- package/lib/sql-ddl-sync/index.d.ts +87 -0
- package/lib/sql-ddl-sync/index.js +372 -0
- package/lib/sql-query/Comparators.d.ts +3 -0
- package/lib/sql-query/Comparators.js +95 -0
- package/lib/sql-query/Create.d.ts +35 -0
- package/lib/sql-query/Create.js +78 -0
- package/lib/sql-query/Dialects/dm.d.ts +3 -0
- package/lib/sql-query/Dialects/dm.js +75 -0
- package/lib/sql-query/Dialects/index.d.ts +10 -0
- package/lib/sql-query/Dialects/index.js +13 -0
- package/lib/sql-query/Dialects/mssql.d.ts +3 -0
- package/lib/sql-query/Dialects/mssql.js +74 -0
- package/lib/sql-query/Dialects/mysql.d.ts +3 -0
- package/lib/sql-query/Dialects/mysql.js +101 -0
- package/lib/sql-query/Dialects/postgresql.d.ts +3 -0
- package/lib/sql-query/Dialects/postgresql.js +77 -0
- package/lib/sql-query/Dialects/sqlite.d.ts +3 -0
- package/lib/sql-query/Dialects/sqlite.js +62 -0
- package/lib/sql-query/Helpers.d.ts +37 -0
- package/lib/sql-query/Helpers.js +260 -0
- package/lib/sql-query/Insert.d.ts +12 -0
- package/lib/sql-query/Insert.js +34 -0
- package/lib/sql-query/Query.d.ts +28 -0
- package/lib/sql-query/Query.js +120 -0
- package/lib/sql-query/Remove.d.ts +16 -0
- package/lib/sql-query/Remove.js +94 -0
- package/lib/sql-query/Select.d.ts +62 -0
- package/lib/sql-query/Select.js +534 -0
- package/lib/sql-query/Set.d.ts +4 -0
- package/lib/sql-query/Set.js +16 -0
- package/lib/sql-query/Typo/Aggregation.d.ts +32 -0
- package/lib/sql-query/Typo/Aggregation.js +2 -0
- package/lib/sql-query/Typo/Comparators.d.ts +140 -0
- package/lib/sql-query/Typo/Comparators.js +2 -0
- package/lib/sql-query/Typo/Dialect.d.ts +39 -0
- package/lib/sql-query/Typo/Dialect.js +2 -0
- package/lib/sql-query/Typo/Field.d.ts +8 -0
- package/lib/sql-query/Typo/Field.js +2 -0
- package/lib/sql-query/Typo/Helper.d.ts +4 -0
- package/lib/sql-query/Typo/Helper.js +2 -0
- package/lib/sql-query/Typo/Query-ChainBuilder.d.ts +80 -0
- package/lib/sql-query/Typo/Query-ChainBuilder.js +2 -0
- package/lib/sql-query/Typo/Query.d.ts +34 -0
- package/lib/sql-query/Typo/Query.js +17 -0
- package/lib/sql-query/Typo/Sql.d.ts +143 -0
- package/lib/sql-query/Typo/Sql.js +2 -0
- package/lib/sql-query/Typo/SubQuery.d.ts +39 -0
- package/lib/sql-query/Typo/SubQuery.js +2 -0
- package/lib/sql-query/Typo/index.d.ts +9 -0
- package/lib/sql-query/Typo/index.js +2 -0
- package/lib/sql-query/Update.d.ts +15 -0
- package/lib/sql-query/Update.js +39 -0
- package/lib/sql-query/Where.d.ts +4 -0
- package/lib/sql-query/Where.js +280 -0
- package/package.json +71 -36
- package/.travis.yml +0 -14
- package/@types/index.d.ts +0 -254
- package/@types/orm_mirror/orm.d.ts +0 -275
- package/@types/orm_mirror/sql-query.d.ts +0 -79
- package/Readme.md +0 -843
- package/lib/index.js +0 -13
- package/lib/modules/mysql.js +0 -35
- package/lib/modules/sqlite3.js +0 -27
- package/lib/patch.js +0 -271
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { FxOrmSqlDDLSync__Dialect } from "../Typo/Dialect";
|
|
2
|
+
type IDialect = FxOrmSqlDDLSync__Dialect.Dialect<Class_DbConnection>;
|
|
3
|
+
export declare const hasCollectionSync: IDialect['hasCollectionSync'];
|
|
4
|
+
export declare const hasCollection: IDialect['hasCollection'];
|
|
5
|
+
export declare const getCollectionPropertiesSync: IDialect['getCollectionPropertiesSync'];
|
|
6
|
+
export declare const getCollectionProperties: IDialect['getCollectionProperties'];
|
|
7
|
+
export declare const createCollectionSync: IDialect['createCollectionSync'];
|
|
8
|
+
export declare const createCollection: IDialect['createCollection'];
|
|
9
|
+
export declare const dropCollectionSync: IDialect['dropCollectionSync'];
|
|
10
|
+
export declare const dropCollection: IDialect['dropCollection'];
|
|
11
|
+
export declare const addPrimaryKeySync: IDialect['addPrimaryKeySync'];
|
|
12
|
+
export declare const addPrimaryKey: IDialect['addPrimaryKey'];
|
|
13
|
+
export declare const dropPrimaryKeySync: IDialect['dropPrimaryKeySync'];
|
|
14
|
+
export declare const dropPrimaryKey: IDialect['dropPrimaryKey'];
|
|
15
|
+
export declare const addForeignKeySync: IDialect['addForeignKeySync'];
|
|
16
|
+
export declare const addForeignKey: IDialect['addForeignKey'];
|
|
17
|
+
export declare const dropForeignKeySync: IDialect['dropForeignKeySync'];
|
|
18
|
+
export declare const dropForeignKey: IDialect['dropForeignKey'];
|
|
19
|
+
export declare const getCollectionColumnsSync: IDialect['getCollectionColumnsSync'];
|
|
20
|
+
export declare const getCollectionColumns: IDialect['getCollectionColumns'];
|
|
21
|
+
export declare const hasCollectionColumnsSync: IDialect['hasCollectionColumnsSync'];
|
|
22
|
+
export declare const hasCollectionColumns: IDialect['hasCollectionColumns'];
|
|
23
|
+
export declare const addCollectionColumnSync: IDialect['addCollectionColumnSync'];
|
|
24
|
+
export declare const addCollectionColumn: IDialect['addCollectionColumn'];
|
|
25
|
+
export declare const renameCollectionColumnSync: IDialect['renameCollectionColumnSync'];
|
|
26
|
+
export declare const renameCollectionColumn: IDialect['renameCollectionColumn'];
|
|
27
|
+
export declare const modifyCollectionColumnSync: IDialect['modifyCollectionColumnSync'];
|
|
28
|
+
export declare const modifyCollectionColumn: IDialect['modifyCollectionColumn'];
|
|
29
|
+
export declare const dropCollectionColumnSync: IDialect['dropCollectionColumnSync'];
|
|
30
|
+
export declare const dropCollectionColumn: IDialect['dropCollectionColumn'];
|
|
31
|
+
export declare const getCollectionIndexesSync: IDialect['getCollectionIndexesSync'];
|
|
32
|
+
export declare const getCollectionIndexes: IDialect['getCollectionIndexes'];
|
|
33
|
+
export declare const addIndexSync: IDialect['addIndexSync'];
|
|
34
|
+
export declare const addIndex: IDialect['addIndex'];
|
|
35
|
+
export declare const removeIndexSync: IDialect['removeIndexSync'];
|
|
36
|
+
export declare const removeIndex: IDialect['removeIndex'];
|
|
37
|
+
export declare const convertIndexes: IDialect['convertIndexes'];
|
|
38
|
+
export declare const toRawType: IDialect['toRawType'];
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toRawType = exports.convertIndexes = exports.removeIndex = exports.removeIndexSync = exports.addIndex = exports.addIndexSync = exports.getCollectionIndexes = exports.getCollectionIndexesSync = exports.dropCollectionColumn = exports.dropCollectionColumnSync = exports.modifyCollectionColumn = exports.modifyCollectionColumnSync = exports.renameCollectionColumn = exports.renameCollectionColumnSync = exports.addCollectionColumn = exports.addCollectionColumnSync = exports.hasCollectionColumns = exports.hasCollectionColumnsSync = exports.getCollectionColumns = exports.getCollectionColumnsSync = exports.dropForeignKey = exports.dropForeignKeySync = exports.addForeignKey = exports.addForeignKeySync = exports.dropPrimaryKey = exports.dropPrimaryKeySync = exports.addPrimaryKey = exports.addPrimaryKeySync = exports.dropCollection = exports.dropCollectionSync = exports.createCollection = exports.createCollectionSync = exports.getCollectionProperties = exports.getCollectionPropertiesSync = exports.hasCollection = exports.hasCollectionSync = void 0;
|
|
4
|
+
const coroutine = require("coroutine");
|
|
5
|
+
const FxORMCore = require("../../orm-core/index");
|
|
6
|
+
const index_1 = require("../../orm-property/index");
|
|
7
|
+
const SQL = require("../SQL");
|
|
8
|
+
const Utils_1 = require("../Utils");
|
|
9
|
+
const Transformer = (0, index_1.transformer)('postgresql');
|
|
10
|
+
const hasCollectionSync = function (dbdriver, name) {
|
|
11
|
+
const rows = dbdriver.execute((0, Utils_1.getSqlQueryDialect)('psql').escape("SELECT * FROM information_schema.tables WHERE table_name = ?", [name]));
|
|
12
|
+
return rows.length > 0;
|
|
13
|
+
};
|
|
14
|
+
exports.hasCollectionSync = hasCollectionSync;
|
|
15
|
+
const hasCollection = function (dbdriver, name, cb) {
|
|
16
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.hasCollectionSync)(dbdriver, name));
|
|
17
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
18
|
+
};
|
|
19
|
+
exports.hasCollection = hasCollection;
|
|
20
|
+
// TODO: add test of it in real db.
|
|
21
|
+
const getCollectionPropertiesSync = function (dbdriver, collection) {
|
|
22
|
+
const cols = (0, exports.getCollectionColumnsSync)(dbdriver, collection);
|
|
23
|
+
const columns = {};
|
|
24
|
+
const columnsComment = (dbdriver.execute((0, Utils_1.getSqlQueryDialect)('psql').escape(`select c.table_schema, c.table_name, c.column_name, pgd.description
|
|
25
|
+
from pg_catalog.pg_statio_all_tables as st
|
|
26
|
+
inner join pg_catalog.pg_description pgd on (
|
|
27
|
+
pgd.objoid = st.relid
|
|
28
|
+
)
|
|
29
|
+
inner join information_schema.columns c on (
|
|
30
|
+
pgd.objsubid = c.ordinal_position and
|
|
31
|
+
c.table_schema = st.schemaname and
|
|
32
|
+
c.table_name = st.relname and
|
|
33
|
+
c.table_name = ?
|
|
34
|
+
);
|
|
35
|
+
`.trim(), [collection])).reduce((accu, cur, idx) => {
|
|
36
|
+
accu[cur.column_name] = cur;
|
|
37
|
+
return accu;
|
|
38
|
+
}, {}));
|
|
39
|
+
coroutine.parallel(cols, (col) => {
|
|
40
|
+
var _a;
|
|
41
|
+
const property = Transformer.rawToProperty(col, {
|
|
42
|
+
collection,
|
|
43
|
+
userOptions: { enumValues: [] },
|
|
44
|
+
}).property;
|
|
45
|
+
if (property.type == "enum") {
|
|
46
|
+
const rows = dbdriver.execute((0, Utils_1.getSqlQueryDialect)('psql').escape(`SELECT t.typname, string_agg(e.enumlabel, '|' ORDER BY e.enumsortorder) AS enum_values
|
|
47
|
+
FROM pg_catalog.pg_type t JOIN pg_catalog.pg_enum e ON t.oid = e.enumtypid WHERE t.typname = ? GROUP BY 1`, [collection + "_enum_" + col.column_name]));
|
|
48
|
+
if (rows.length) {
|
|
49
|
+
property.values = rows[0].enum_values.split("|");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
property.comment = ((_a = columnsComment[col.column_name]) === null || _a === void 0 ? void 0 : _a.description) || '';
|
|
53
|
+
columns[col.column_name] = property;
|
|
54
|
+
});
|
|
55
|
+
return columns;
|
|
56
|
+
};
|
|
57
|
+
exports.getCollectionPropertiesSync = getCollectionPropertiesSync;
|
|
58
|
+
const getCollectionProperties = function (dbdriver, name, cb) {
|
|
59
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.getCollectionPropertiesSync)(dbdriver, name));
|
|
60
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
61
|
+
};
|
|
62
|
+
exports.getCollectionProperties = getCollectionProperties;
|
|
63
|
+
const createCollectionSync = function (dbdriver, name, columns, keys, opts) {
|
|
64
|
+
return dbdriver.execute(SQL.CREATE_TABLE({
|
|
65
|
+
name: name,
|
|
66
|
+
columns: columns,
|
|
67
|
+
keys: keys,
|
|
68
|
+
comment: opts.comment
|
|
69
|
+
}, 'psql'));
|
|
70
|
+
};
|
|
71
|
+
exports.createCollectionSync = createCollectionSync;
|
|
72
|
+
const createCollection = function (dbdriver, name, columns, keys, opts, cb) {
|
|
73
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.createCollectionSync)(dbdriver, name, columns, keys, opts));
|
|
74
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
75
|
+
};
|
|
76
|
+
exports.createCollection = createCollection;
|
|
77
|
+
const dropCollectionSync = function (dbdriver, name) {
|
|
78
|
+
return dbdriver.execute(SQL.DROP_TABLE({
|
|
79
|
+
name: name
|
|
80
|
+
}, 'psql'));
|
|
81
|
+
};
|
|
82
|
+
exports.dropCollectionSync = dropCollectionSync;
|
|
83
|
+
const dropCollection = function (dbdriver, name, cb) {
|
|
84
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.dropCollectionSync)(dbdriver, name));
|
|
85
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
86
|
+
};
|
|
87
|
+
exports.dropCollection = dropCollection;
|
|
88
|
+
const addPrimaryKeySync = function (dbdriver, tableName, columnName) {
|
|
89
|
+
return dbdriver.execute((0, Utils_1.getSqlQueryDialect)('psql').escape("ALTER TABLE ?? ADD CONSTRAINT ?? PRIMARY KEY(??);", [tableName, tableName + "_" + columnName + "_pk", columnName]));
|
|
90
|
+
};
|
|
91
|
+
exports.addPrimaryKeySync = addPrimaryKeySync;
|
|
92
|
+
const addPrimaryKey = function (dbdriver, tableName, columnName, cb) {
|
|
93
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.addPrimaryKeySync)(dbdriver, tableName, columnName));
|
|
94
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
95
|
+
};
|
|
96
|
+
exports.addPrimaryKey = addPrimaryKey;
|
|
97
|
+
const dropPrimaryKeySync = function (dbdriver, tableName, columnName) {
|
|
98
|
+
return dbdriver.execute((0, Utils_1.getSqlQueryDialect)('psql').escape("ALTER TABLE ?? DROP CONSTRAINT ??;", [tableName, tableName + "_" + columnName + "_pk"]));
|
|
99
|
+
};
|
|
100
|
+
exports.dropPrimaryKeySync = dropPrimaryKeySync;
|
|
101
|
+
const dropPrimaryKey = function (dbdriver, tableName, columnName, cb) {
|
|
102
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.dropPrimaryKeySync)(dbdriver, tableName, columnName));
|
|
103
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
104
|
+
};
|
|
105
|
+
exports.dropPrimaryKey = dropPrimaryKey;
|
|
106
|
+
const addForeignKeySync = function (dbdriver, tableName, options) {
|
|
107
|
+
return dbdriver.execute((0, Utils_1.getSqlQueryDialect)('psql').escape("ALTER TABLE ?? ADD FOREIGN KEY(??) REFERENCES ?? (??);", [tableName, options.name, options.references.table, options.references.column]));
|
|
108
|
+
};
|
|
109
|
+
exports.addForeignKeySync = addForeignKeySync;
|
|
110
|
+
const addForeignKey = function (dbdriver, tableName, options, cb) {
|
|
111
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.addForeignKeySync)(dbdriver, tableName, options));
|
|
112
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
113
|
+
};
|
|
114
|
+
exports.addForeignKey = addForeignKey;
|
|
115
|
+
const dropForeignKeySync = function (dbdriver, tableName, columnName) {
|
|
116
|
+
return dbdriver.execute((0, Utils_1.getSqlQueryDialect)('psql').escape("ALTER TABLE ?? DROP CONSTRAINT ??;", [tableName, tableName + '_' + columnName + '_fkey']));
|
|
117
|
+
};
|
|
118
|
+
exports.dropForeignKeySync = dropForeignKeySync;
|
|
119
|
+
const dropForeignKey = function (dbdriver, tableName, columnName, cb) {
|
|
120
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.dropForeignKeySync)(dbdriver, tableName, columnName));
|
|
121
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
122
|
+
};
|
|
123
|
+
exports.dropForeignKey = dropForeignKey;
|
|
124
|
+
const getCollectionColumnsSync = function (dbdriver, name) {
|
|
125
|
+
var _a, _b;
|
|
126
|
+
const schema = ((_a = dbdriver.config.query) === null || _a === void 0 ? void 0 : _a.search_path) || ((_b = dbdriver.config.query) === null || _b === void 0 ? void 0 : _b.searchPath) || 'public';
|
|
127
|
+
return dbdriver.execute((0, Utils_1.getSqlQueryDialect)('psql').escape("SELECT * FROM information_schema.columns WHERE table_name = ? AND table_schema = ?;", [name, schema]));
|
|
128
|
+
};
|
|
129
|
+
exports.getCollectionColumnsSync = getCollectionColumnsSync;
|
|
130
|
+
const getCollectionColumns = function (dbdriver, name, cb) {
|
|
131
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.getCollectionColumnsSync)(dbdriver, name));
|
|
132
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
133
|
+
};
|
|
134
|
+
exports.getCollectionColumns = getCollectionColumns;
|
|
135
|
+
const hasCollectionColumnsSync = function (dbdriver, name, column) {
|
|
136
|
+
const columnSet = new Set((0, Utils_1.arraify)(column));
|
|
137
|
+
const res = dbdriver.execute((0, Utils_1.getSqlQueryDialect)('psql').escape(`select column_name from information_schema.columns where table_name = ? and column_name in (${[...columnSet].map(col => `'${col}'`).join(', ')});`, [name]));
|
|
138
|
+
const resSet = new Set(res.map(({ column_name }) => column_name));
|
|
139
|
+
return [...columnSet].every(column => resSet.has(column));
|
|
140
|
+
};
|
|
141
|
+
exports.hasCollectionColumnsSync = hasCollectionColumnsSync;
|
|
142
|
+
const hasCollectionColumns = function (dbdriver, name, column, cb) {
|
|
143
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.hasCollectionColumnsSync)(dbdriver, name, column));
|
|
144
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
145
|
+
};
|
|
146
|
+
exports.hasCollectionColumns = hasCollectionColumns;
|
|
147
|
+
const addCollectionColumnSync = function (dbdriver, name, column, afterColumn) {
|
|
148
|
+
return dbdriver.execute((0, Utils_1.getSqlQueryDialect)('psql').escape(`ALTER TABLE ?? ADD ${column};`, [name]));
|
|
149
|
+
};
|
|
150
|
+
exports.addCollectionColumnSync = addCollectionColumnSync;
|
|
151
|
+
const addCollectionColumn = function (dbdriver, name, column, after_column, cb) {
|
|
152
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.addCollectionColumnSync)(dbdriver, name, column, after_column));
|
|
153
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
154
|
+
};
|
|
155
|
+
exports.addCollectionColumn = addCollectionColumn;
|
|
156
|
+
const renameCollectionColumnSync = function (dbdriver, name, oldColName, newColName) {
|
|
157
|
+
var sql = SQL.ALTER_TABLE_RENAME_COLUMN({
|
|
158
|
+
name: name, oldColName: oldColName, newColName: newColName
|
|
159
|
+
}, 'psql');
|
|
160
|
+
return dbdriver.execute(sql);
|
|
161
|
+
};
|
|
162
|
+
exports.renameCollectionColumnSync = renameCollectionColumnSync;
|
|
163
|
+
const renameCollectionColumn = function (dbdriver, name, oldColName, newColName, cb) {
|
|
164
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.renameCollectionColumnSync)(dbdriver, name, oldColName, newColName));
|
|
165
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
166
|
+
};
|
|
167
|
+
exports.renameCollectionColumn = renameCollectionColumn;
|
|
168
|
+
const modifyCollectionColumnSync = function (dbdriver, name, column) {
|
|
169
|
+
let p = column.indexOf(" ");
|
|
170
|
+
const col_name = column.slice(0, p);
|
|
171
|
+
let col_type;
|
|
172
|
+
column = column.slice(p + 1);
|
|
173
|
+
p = column.indexOf(" ");
|
|
174
|
+
if (p > 0) {
|
|
175
|
+
col_type = column.slice(0, p);
|
|
176
|
+
column = column.slice(p + 1);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
col_type = column;
|
|
180
|
+
column = '';
|
|
181
|
+
}
|
|
182
|
+
var res;
|
|
183
|
+
res = dbdriver.execute((0, Utils_1.getSqlQueryDialect)('psql').escape(`ALTER TABLE ?? ALTER ${col_name} TYPE ${col_type}`, [name, col_name]));
|
|
184
|
+
if (column) {
|
|
185
|
+
if (column.match(/NOT NULL/)) {
|
|
186
|
+
res = dbdriver.execute((0, Utils_1.getSqlQueryDialect)('psql').escape(`ALTER TABLE ?? ALTER ${col_name} SET NOT NULL`, [name]));
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
res = dbdriver.execute((0, Utils_1.getSqlQueryDialect)('psql').escape(`ALTER TABLE ?? ALTER ${col_name} DROP NOT NULL`, [name]));
|
|
190
|
+
}
|
|
191
|
+
let m;
|
|
192
|
+
if (m = column.match(/DEFAULT (.+)$/)) {
|
|
193
|
+
res = dbdriver.execute((0, Utils_1.getSqlQueryDialect)('psql').escape(`ALTER TABLE ?? ALTER ${col_name} SET DEFAULT ${m[1]}`, [name]));
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return res;
|
|
197
|
+
};
|
|
198
|
+
exports.modifyCollectionColumnSync = modifyCollectionColumnSync;
|
|
199
|
+
const modifyCollectionColumn = function (dbdriver, name, column, cb) {
|
|
200
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.modifyCollectionColumnSync)(dbdriver, name, column));
|
|
201
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
202
|
+
};
|
|
203
|
+
exports.modifyCollectionColumn = modifyCollectionColumn;
|
|
204
|
+
const dropCollectionColumnSync = function (dbdriver, name, column) {
|
|
205
|
+
return dbdriver.execute(SQL.ALTER_TABLE_DROP_COLUMN({
|
|
206
|
+
name: name,
|
|
207
|
+
column: column
|
|
208
|
+
}, 'psql'));
|
|
209
|
+
};
|
|
210
|
+
exports.dropCollectionColumnSync = dropCollectionColumnSync;
|
|
211
|
+
const dropCollectionColumn = function (dbdriver, name, column, cb) {
|
|
212
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.dropCollectionColumnSync)(dbdriver, name, column));
|
|
213
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
214
|
+
};
|
|
215
|
+
exports.dropCollectionColumn = dropCollectionColumn;
|
|
216
|
+
const getCollectionIndexesSync = function (dbdriver, name) {
|
|
217
|
+
const rows = dbdriver.execute((0, Utils_1.getSqlQueryDialect)('psql').escape("SELECT t.relname, i.relname, a.attname, ix.indisunique, ix.indisprimary " +
|
|
218
|
+
"FROM pg_class t, pg_class i, pg_index ix, pg_attribute a " +
|
|
219
|
+
"WHERE t.oid = ix.indrelid AND i.oid = ix.indexrelid " +
|
|
220
|
+
"AND a.attrelid = t.oid AND a.attnum = ANY(ix.indkey) " +
|
|
221
|
+
"AND t.relkind = 'r' AND (t.relname = ? OR i.relname::text like ?)", [name, `${name}_%`]));
|
|
222
|
+
return convertIndexRows(name, rows);
|
|
223
|
+
};
|
|
224
|
+
exports.getCollectionIndexesSync = getCollectionIndexesSync;
|
|
225
|
+
const getCollectionIndexes = function (dbdriver, name, cb) {
|
|
226
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.getCollectionIndexesSync)(dbdriver, name));
|
|
227
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
228
|
+
};
|
|
229
|
+
exports.getCollectionIndexes = getCollectionIndexes;
|
|
230
|
+
const addIndexSync = function (dbdriver, name, unique, collection, columns) {
|
|
231
|
+
return dbdriver.execute(SQL.CREATE_INDEX({
|
|
232
|
+
name: name,
|
|
233
|
+
unique: unique,
|
|
234
|
+
collection: collection,
|
|
235
|
+
columns: columns
|
|
236
|
+
}, 'psql'));
|
|
237
|
+
};
|
|
238
|
+
exports.addIndexSync = addIndexSync;
|
|
239
|
+
const addIndex = function (dbdriver, name, unique, collection, columns, cb) {
|
|
240
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.addIndexSync)(dbdriver, name, unique, collection, columns));
|
|
241
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
242
|
+
};
|
|
243
|
+
exports.addIndex = addIndex;
|
|
244
|
+
const removeIndexSync = function (dbdriver, collection, name) {
|
|
245
|
+
return dbdriver.execute("DROP INDEX " + (0, Utils_1.getSqlQueryDialect)('psql').escapeId(name));
|
|
246
|
+
};
|
|
247
|
+
exports.removeIndexSync = removeIndexSync;
|
|
248
|
+
const removeIndex = function (dbdriver, collection, name, cb) {
|
|
249
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.removeIndexSync)(dbdriver, collection, name));
|
|
250
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
251
|
+
};
|
|
252
|
+
exports.removeIndex = removeIndex;
|
|
253
|
+
const convertIndexes = function (collection, indexes) {
|
|
254
|
+
for (let i = 0; i < indexes.length; i++) {
|
|
255
|
+
indexes[i].name = collection + "_" + indexes[i].name;
|
|
256
|
+
}
|
|
257
|
+
return indexes;
|
|
258
|
+
};
|
|
259
|
+
exports.convertIndexes = convertIndexes;
|
|
260
|
+
const toRawType = function (property, ctx) {
|
|
261
|
+
var _a, _b;
|
|
262
|
+
return Transformer.toStorageType(property, {
|
|
263
|
+
collection: ctx.collection,
|
|
264
|
+
customTypes: (_a = ctx.driver) === null || _a === void 0 ? void 0 : _a.customTypes,
|
|
265
|
+
escapeVal: (0, Utils_1.getSqlQueryDialect)(((_b = ctx.driver) === null || _b === void 0 ? void 0 : _b.type) || 'postgresql').escapeVal,
|
|
266
|
+
});
|
|
267
|
+
};
|
|
268
|
+
exports.toRawType = toRawType;
|
|
269
|
+
function convertIndexRows(collection, rows) {
|
|
270
|
+
const indexes = {};
|
|
271
|
+
for (let i = 0; i < rows.length; i++) {
|
|
272
|
+
if (rows[i].indisprimary === '1' || rows[i].indisprimary === true) {
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
const idx_name = rows[i].relname;
|
|
276
|
+
if (!indexes.hasOwnProperty(idx_name)) {
|
|
277
|
+
indexes[idx_name] = {
|
|
278
|
+
collection,
|
|
279
|
+
name: idx_name,
|
|
280
|
+
columns: [],
|
|
281
|
+
unique: rows[i].indisunique === '1' || rows[i].indisunique === true,
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
indexes[idx_name].columns.push(rows[i].attname);
|
|
285
|
+
}
|
|
286
|
+
return indexes;
|
|
287
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { FxOrmSqlDDLSync__Dialect } from "../Typo/Dialect";
|
|
2
|
+
type IDialect = FxOrmSqlDDLSync__Dialect.Dialect<Class_SQLite>;
|
|
3
|
+
export declare const hasCollectionSync: IDialect['hasCollectionSync'];
|
|
4
|
+
export declare const hasCollection: IDialect['hasCollection'];
|
|
5
|
+
/**
|
|
6
|
+
* @no_test
|
|
7
|
+
*/
|
|
8
|
+
export declare const addPrimaryKeySync: IDialect['addPrimaryKeySync'];
|
|
9
|
+
export declare const addPrimaryKey: IDialect['addPrimaryKey'];
|
|
10
|
+
export declare const dropPrimaryKeySync: IDialect['dropPrimaryKeySync'];
|
|
11
|
+
export declare const dropPrimaryKey: IDialect['dropPrimaryKey'];
|
|
12
|
+
export declare const addForeignKeySync: IDialect['addForeignKeySync'];
|
|
13
|
+
export declare const addForeignKey: IDialect['addForeignKey'];
|
|
14
|
+
export declare const dropForeignKeySync: IDialect['dropForeignKeySync'];
|
|
15
|
+
export declare const dropForeignKey: IDialect['dropForeignKey'];
|
|
16
|
+
export declare const getCollectionColumnsSync: IDialect['getCollectionColumnsSync'];
|
|
17
|
+
export declare const getCollectionColumns: IDialect['getCollectionColumns'];
|
|
18
|
+
export declare const getCollectionPropertiesSync: IDialect['getCollectionPropertiesSync'];
|
|
19
|
+
export declare const getCollectionProperties: IDialect['getCollectionProperties'];
|
|
20
|
+
export declare const createCollectionSync: IDialect['createCollectionSync'];
|
|
21
|
+
export declare const createCollection: IDialect['createCollection'];
|
|
22
|
+
export declare const dropCollectionSync: IDialect['dropCollectionSync'];
|
|
23
|
+
export declare const dropCollection: IDialect['dropCollection'];
|
|
24
|
+
export declare const hasCollectionColumnsSync: IDialect['hasCollectionColumnsSync'];
|
|
25
|
+
export declare const hasCollectionColumns: IDialect['hasCollectionColumns'];
|
|
26
|
+
export declare const addCollectionColumnSync: IDialect['addCollectionColumnSync'];
|
|
27
|
+
export declare const addCollectionColumn: IDialect['addCollectionColumn'];
|
|
28
|
+
export declare const renameCollectionColumnSync: IDialect['renameCollectionColumnSync'];
|
|
29
|
+
export declare const renameCollectionColumn: IDialect['renameCollectionColumn'];
|
|
30
|
+
export declare const modifyCollectionColumnSync: IDialect['modifyCollectionColumnSync'];
|
|
31
|
+
export declare const modifyCollectionColumn: IDialect['modifyCollectionColumn'];
|
|
32
|
+
export declare const dropCollectionColumnSync: IDialect['dropCollectionColumnSync'];
|
|
33
|
+
export declare const dropCollectionColumn: IDialect['dropCollectionColumn'];
|
|
34
|
+
export declare const getCollectionIndexesSync: IDialect['getCollectionIndexesSync'];
|
|
35
|
+
export declare const getCollectionIndexes: IDialect['getCollectionIndexes'];
|
|
36
|
+
export declare const addIndexSync: IDialect['addIndexSync'];
|
|
37
|
+
export declare const addIndex: IDialect['addIndex'];
|
|
38
|
+
export declare const removeIndexSync: IDialect['removeIndexSync'];
|
|
39
|
+
export declare const removeIndex: IDialect['removeIndex'];
|
|
40
|
+
export declare const processKeys: IDialect['processKeys'];
|
|
41
|
+
export declare const supportsType: IDialect['supportsType'];
|
|
42
|
+
export declare const toRawType: IDialect['toRawType'];
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toRawType = exports.supportsType = exports.processKeys = exports.removeIndex = exports.removeIndexSync = exports.addIndex = exports.addIndexSync = exports.getCollectionIndexes = exports.getCollectionIndexesSync = exports.dropCollectionColumn = exports.dropCollectionColumnSync = exports.modifyCollectionColumn = exports.modifyCollectionColumnSync = exports.renameCollectionColumn = exports.renameCollectionColumnSync = exports.addCollectionColumn = exports.addCollectionColumnSync = exports.hasCollectionColumns = exports.hasCollectionColumnsSync = exports.dropCollection = exports.dropCollectionSync = exports.createCollection = exports.createCollectionSync = exports.getCollectionProperties = exports.getCollectionPropertiesSync = exports.getCollectionColumns = exports.getCollectionColumnsSync = exports.dropForeignKey = exports.dropForeignKeySync = exports.addForeignKey = exports.addForeignKeySync = exports.dropPrimaryKey = exports.dropPrimaryKeySync = exports.addPrimaryKey = exports.addPrimaryKeySync = exports.hasCollection = exports.hasCollectionSync = void 0;
|
|
4
|
+
const FxORMCore = require("../../orm-core/index");
|
|
5
|
+
const index_1 = require("../../orm-property/index");
|
|
6
|
+
const SQL = require("../SQL");
|
|
7
|
+
const Utils_1 = require("../Utils");
|
|
8
|
+
const Transformer = (0, index_1.transformer)('sqlite');
|
|
9
|
+
// @see https://www.sqlite.org/lang_altertable.html
|
|
10
|
+
const hasCollectionSync = function (dbdriver, name) {
|
|
11
|
+
const rows = dbdriver.execute((0, Utils_1.getSqlQueryDialect)('sqlite').escape("SELECT * FROM sqlite_master WHERE type = 'table' and name = ?", [name]));
|
|
12
|
+
return rows.length > 0;
|
|
13
|
+
};
|
|
14
|
+
exports.hasCollectionSync = hasCollectionSync;
|
|
15
|
+
const hasCollection = function (dbdriver, name, cb) {
|
|
16
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.hasCollectionSync)(dbdriver, name));
|
|
17
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
18
|
+
};
|
|
19
|
+
exports.hasCollection = hasCollection;
|
|
20
|
+
/**
|
|
21
|
+
* @no_test
|
|
22
|
+
*/
|
|
23
|
+
const addPrimaryKeySync = function (dbdriver, tableName, columnName) {
|
|
24
|
+
return dbdriver.execute((0, Utils_1.getSqlQueryDialect)('sqlite').escape("ALTER TABLE ?? ADD CONSTRAINT ?? PRIMARY KEY(??);", [tableName, columnName + "PK", columnName]));
|
|
25
|
+
};
|
|
26
|
+
exports.addPrimaryKeySync = addPrimaryKeySync;
|
|
27
|
+
const addPrimaryKey = function (dbdriver, tableName, columnName, cb) {
|
|
28
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.addPrimaryKeySync)(dbdriver, tableName, columnName));
|
|
29
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
30
|
+
};
|
|
31
|
+
exports.addPrimaryKey = addPrimaryKey;
|
|
32
|
+
const dropPrimaryKeySync = function (dbdriver, tableName, columnName) {
|
|
33
|
+
return dbdriver.execute((0, Utils_1.getSqlQueryDialect)('sqlite').escape("ALTER TABLE ?? DROP CONSTRAINT ??;", [tableName, columnName + "PK"]));
|
|
34
|
+
};
|
|
35
|
+
exports.dropPrimaryKeySync = dropPrimaryKeySync;
|
|
36
|
+
const dropPrimaryKey = function (dbdriver, tableName, columnName, cb) {
|
|
37
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.dropPrimaryKeySync)(dbdriver, tableName, columnName));
|
|
38
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
39
|
+
};
|
|
40
|
+
exports.dropPrimaryKey = dropPrimaryKey;
|
|
41
|
+
const addForeignKeySync = function (dbdriver, tableName, options) {
|
|
42
|
+
return dbdriver.execute((0, Utils_1.getSqlQueryDialect)('sqlite').escape("ALTER TABLE ?? ADD FOREIGN KEY(??) REFERENCES ??(??);", [tableName, options.name, options.references.table, options.references.column]));
|
|
43
|
+
};
|
|
44
|
+
exports.addForeignKeySync = addForeignKeySync;
|
|
45
|
+
const addForeignKey = function (dbdriver, tableName, options, cb) {
|
|
46
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.addForeignKeySync)(dbdriver, tableName, options));
|
|
47
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
48
|
+
};
|
|
49
|
+
exports.addForeignKey = addForeignKey;
|
|
50
|
+
const dropForeignKeySync = function (dbdriver, tableName, columnName) {
|
|
51
|
+
return dbdriver.execute((0, Utils_1.getSqlQueryDialect)('sqlite').escape("ALTER TABLE ?? DROP CONSTRAINT ??;", [tableName, tableName + "_" + columnName + "_fkey"]));
|
|
52
|
+
};
|
|
53
|
+
exports.dropForeignKeySync = dropForeignKeySync;
|
|
54
|
+
const dropForeignKey = function (dbdriver, tableName, columnName, cb) {
|
|
55
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.dropForeignKeySync)(dbdriver, tableName, columnName));
|
|
56
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
57
|
+
};
|
|
58
|
+
exports.dropForeignKey = dropForeignKey;
|
|
59
|
+
const getCollectionColumnsSync = function (dbdriver, name) {
|
|
60
|
+
return dbdriver.execute((0, Utils_1.getSqlQueryDialect)('sqlite').escape("PRAGMA table_info(??)", [name]));
|
|
61
|
+
};
|
|
62
|
+
exports.getCollectionColumnsSync = getCollectionColumnsSync;
|
|
63
|
+
const getCollectionColumns = function (dbdriver, name, cb) {
|
|
64
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.getCollectionColumnsSync)(dbdriver, name));
|
|
65
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
66
|
+
};
|
|
67
|
+
exports.getCollectionColumns = getCollectionColumns;
|
|
68
|
+
const getCollectionPropertiesSync = function (dbdriver, name) {
|
|
69
|
+
const cols = (0, exports.getCollectionColumnsSync)(dbdriver, name);
|
|
70
|
+
let columns = {};
|
|
71
|
+
for (let i = 0; i < cols.length; i++) {
|
|
72
|
+
const dCol = cols[i];
|
|
73
|
+
columns[dCol.name] = Transformer.rawToProperty(dCol, {
|
|
74
|
+
collection: name,
|
|
75
|
+
}).property;
|
|
76
|
+
}
|
|
77
|
+
return columns;
|
|
78
|
+
};
|
|
79
|
+
exports.getCollectionPropertiesSync = getCollectionPropertiesSync;
|
|
80
|
+
const getCollectionProperties = function (dbdriver, name, cb) {
|
|
81
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.getCollectionPropertiesSync)(dbdriver, name));
|
|
82
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
83
|
+
};
|
|
84
|
+
exports.getCollectionProperties = getCollectionProperties;
|
|
85
|
+
const createCollectionSync = function (dbdriver, name, columns, keys, opts) {
|
|
86
|
+
return dbdriver.execute(SQL.CREATE_TABLE({
|
|
87
|
+
name: name,
|
|
88
|
+
columns: columns,
|
|
89
|
+
keys: keys,
|
|
90
|
+
comment: opts.comment
|
|
91
|
+
}, 'sqlite'));
|
|
92
|
+
};
|
|
93
|
+
exports.createCollectionSync = createCollectionSync;
|
|
94
|
+
const createCollection = function (dbdriver, name, columns, keys, opts, cb) {
|
|
95
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.createCollectionSync)(dbdriver, name, columns, keys));
|
|
96
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
97
|
+
};
|
|
98
|
+
exports.createCollection = createCollection;
|
|
99
|
+
const dropCollectionSync = function (dbdriver, name) {
|
|
100
|
+
return dbdriver.execute(SQL.DROP_TABLE({ name: name }, 'sqlite'));
|
|
101
|
+
};
|
|
102
|
+
exports.dropCollectionSync = dropCollectionSync;
|
|
103
|
+
const dropCollection = function (dbdriver, name, cb) {
|
|
104
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.dropCollectionSync)(dbdriver, name));
|
|
105
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
106
|
+
};
|
|
107
|
+
exports.dropCollection = dropCollection;
|
|
108
|
+
const hasCollectionColumnsSync = function (dbdriver, name, column) {
|
|
109
|
+
const cols = (0, exports.getCollectionColumnsSync)(dbdriver, name);
|
|
110
|
+
return (0, Utils_1.arraify)(column).every(column_name => cols.find(col => col.name === column_name));
|
|
111
|
+
};
|
|
112
|
+
exports.hasCollectionColumnsSync = hasCollectionColumnsSync;
|
|
113
|
+
const hasCollectionColumns = function (dbdriver, name, column, cb) {
|
|
114
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.hasCollectionColumnsSync)(dbdriver, name, column));
|
|
115
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
116
|
+
};
|
|
117
|
+
exports.hasCollectionColumns = hasCollectionColumns;
|
|
118
|
+
const addCollectionColumnSync = function (dbdriver, name, column, after_column) {
|
|
119
|
+
// const rows = dbdriver.execute<any[]>(
|
|
120
|
+
// getSqlQueryDialect('sqlite').escape(
|
|
121
|
+
// "SELECT name FROM pragma_table_info(?) ORDER BY cid DESC LIMIT 1;", [name]
|
|
122
|
+
// )
|
|
123
|
+
// )
|
|
124
|
+
// const lastColName = rows[0].name;
|
|
125
|
+
// if (after_column && lastColName.toLowerCase() !== after_column.toLowerCase()) {
|
|
126
|
+
// throw new Error(`Only support add column after last column ${lastColName}`);
|
|
127
|
+
// }
|
|
128
|
+
// after_column = lastColName;
|
|
129
|
+
return dbdriver.execute(SQL.ALTER_TABLE_ADD_COLUMN({
|
|
130
|
+
name: name,
|
|
131
|
+
column: column,
|
|
132
|
+
after: undefined,
|
|
133
|
+
first: undefined
|
|
134
|
+
}, 'sqlite'));
|
|
135
|
+
};
|
|
136
|
+
exports.addCollectionColumnSync = addCollectionColumnSync;
|
|
137
|
+
const addCollectionColumn = function (dbdriver, name, column, after_column, cb) {
|
|
138
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.addCollectionColumnSync)(dbdriver, name, column, after_column));
|
|
139
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
140
|
+
};
|
|
141
|
+
exports.addCollectionColumn = addCollectionColumn;
|
|
142
|
+
const renameCollectionColumnSync = function (dbdriver, name, oldColName, newColName) {
|
|
143
|
+
return dbdriver.execute(SQL.ALTER_TABLE_RENAME_COLUMN({
|
|
144
|
+
name: name, oldColName: oldColName, newColName: newColName
|
|
145
|
+
}, 'sqlite'));
|
|
146
|
+
};
|
|
147
|
+
exports.renameCollectionColumnSync = renameCollectionColumnSync;
|
|
148
|
+
const renameCollectionColumn = function (dbdriver, name, oldColName, newColName, cb) {
|
|
149
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.renameCollectionColumnSync)(dbdriver, name, oldColName, newColName));
|
|
150
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
151
|
+
};
|
|
152
|
+
exports.renameCollectionColumn = renameCollectionColumn;
|
|
153
|
+
const modifyCollectionColumnSync = function (dbdriver, name, column) {
|
|
154
|
+
return dbdriver.execute(SQL.ALTER_TABLE_MODIFY_COLUMN({
|
|
155
|
+
name: name,
|
|
156
|
+
column: column
|
|
157
|
+
}, 'sqlite'));
|
|
158
|
+
};
|
|
159
|
+
exports.modifyCollectionColumnSync = modifyCollectionColumnSync;
|
|
160
|
+
const modifyCollectionColumn = function (dbdriver, name, column, cb) {
|
|
161
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.modifyCollectionColumnSync)(dbdriver, name, column));
|
|
162
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
163
|
+
};
|
|
164
|
+
exports.modifyCollectionColumn = modifyCollectionColumn;
|
|
165
|
+
const dropCollectionColumnSync = function (dbdriver, name, column) {
|
|
166
|
+
throw new Error('sqlite does not support dropping columns');
|
|
167
|
+
};
|
|
168
|
+
exports.dropCollectionColumnSync = dropCollectionColumnSync;
|
|
169
|
+
const dropCollectionColumn = function (dbdriver, name, column, cb) {
|
|
170
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.dropCollectionColumnSync)(dbdriver, name, column));
|
|
171
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
172
|
+
};
|
|
173
|
+
exports.dropCollectionColumn = dropCollectionColumn;
|
|
174
|
+
const getCollectionIndexesSync = function (dbdriver, name) {
|
|
175
|
+
const rows = dbdriver.execute("PRAGMA index_list(" + (0, Utils_1.getSqlQueryDialect)('sqlite').escapeId(name) + ")");
|
|
176
|
+
const indexes = convertIndexRows(rows);
|
|
177
|
+
for (let k in indexes) {
|
|
178
|
+
if (k.match(/^sqlite_autoindex/)) {
|
|
179
|
+
delete indexes[k];
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
const rows = dbdriver.execute(`PRAGMA index_info(${(0, Utils_1.getSqlQueryDialect)('sqlite').escapeVal(k)})`);
|
|
183
|
+
for (let i = 0; i < rows.length; i++) {
|
|
184
|
+
indexes[k].columns.push(rows[i].name);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return indexes;
|
|
188
|
+
};
|
|
189
|
+
exports.getCollectionIndexesSync = getCollectionIndexesSync;
|
|
190
|
+
const getCollectionIndexes = function (dbdriver, name, cb) {
|
|
191
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.getCollectionIndexesSync)(dbdriver, name));
|
|
192
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
193
|
+
};
|
|
194
|
+
exports.getCollectionIndexes = getCollectionIndexes;
|
|
195
|
+
const addIndexSync = function (dbdriver, name, unique, collection, columns) {
|
|
196
|
+
return dbdriver.execute(SQL.CREATE_INDEX({
|
|
197
|
+
name: name,
|
|
198
|
+
unique: unique,
|
|
199
|
+
collection: collection,
|
|
200
|
+
columns: columns
|
|
201
|
+
}, 'sqlite'));
|
|
202
|
+
};
|
|
203
|
+
exports.addIndexSync = addIndexSync;
|
|
204
|
+
const addIndex = function (dbdriver, name, unique, collection, columns, cb) {
|
|
205
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.addIndexSync)(dbdriver, name, unique, collection, columns));
|
|
206
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
207
|
+
};
|
|
208
|
+
exports.addIndex = addIndex;
|
|
209
|
+
const removeIndexSync = function (dbdriver, collection, name) {
|
|
210
|
+
return dbdriver.execute(`DROP INDEX IF EXISTS ${(0, Utils_1.getSqlQueryDialect)('sqlite').escapeId(name)}`);
|
|
211
|
+
};
|
|
212
|
+
exports.removeIndexSync = removeIndexSync;
|
|
213
|
+
const removeIndex = function (dbdriver, collection, name, cb) {
|
|
214
|
+
const exposedErrResults = FxORMCore.Utils.exposeErrAndResultFromSyncMethod(() => (0, exports.removeIndexSync)(dbdriver, collection, name));
|
|
215
|
+
FxORMCore.Utils.throwErrOrCallabckErrResult(exposedErrResults, { no_throw: true, callback: cb });
|
|
216
|
+
};
|
|
217
|
+
exports.removeIndex = removeIndex;
|
|
218
|
+
const processKeys = function (keys) {
|
|
219
|
+
if (keys.length === 1) {
|
|
220
|
+
return [];
|
|
221
|
+
}
|
|
222
|
+
return keys;
|
|
223
|
+
};
|
|
224
|
+
exports.processKeys = processKeys;
|
|
225
|
+
const supportsType = function (type) {
|
|
226
|
+
switch (type) {
|
|
227
|
+
case "boolean":
|
|
228
|
+
case "enum":
|
|
229
|
+
return "number";
|
|
230
|
+
}
|
|
231
|
+
return type;
|
|
232
|
+
};
|
|
233
|
+
exports.supportsType = supportsType;
|
|
234
|
+
const toRawType = function (property, ctx) {
|
|
235
|
+
var _a, _b, _c;
|
|
236
|
+
return Transformer.toStorageType(property, {
|
|
237
|
+
collection: ctx.collection,
|
|
238
|
+
customTypes: (_a = ctx.driver) === null || _a === void 0 ? void 0 : _a.customTypes,
|
|
239
|
+
escapeVal: (0, Utils_1.getSqlQueryDialect)(((_b = ctx.driver) === null || _b === void 0 ? void 0 : _b.type) || 'sqlite').escapeVal,
|
|
240
|
+
userOptions: {
|
|
241
|
+
useDefaultValue: (_c = ctx.userOptions) === null || _c === void 0 ? void 0 : _c.useDefaultValue,
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
};
|
|
245
|
+
exports.toRawType = toRawType;
|
|
246
|
+
function convertIndexRows(rows) {
|
|
247
|
+
const indexes = {};
|
|
248
|
+
for (let i = 0; i < rows.length; i++) {
|
|
249
|
+
if (!indexes.hasOwnProperty(rows[i].name)) {
|
|
250
|
+
indexes[rows[i].name] = {
|
|
251
|
+
columns: [],
|
|
252
|
+
unique: rows[i].unique
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return indexes;
|
|
257
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FxOrmSqlDDLSync__SQL } from './Typo/SQL';
|
|
2
|
+
import { FxDbDriverNS } from "../db-driver/Typo";
|
|
3
|
+
export declare function CREATE_TABLE(options: FxOrmSqlDDLSync__SQL.TableOptions, db_type: FxDbDriverNS.DriverType): string;
|
|
4
|
+
export declare function ALTER_TABLE_COMMENT(db_type: FxDbDriverNS.DriverType, table: string, comment?: string): string;
|
|
5
|
+
export declare function DROP_TABLE(options: FxOrmSqlDDLSync__SQL.TableOptions, db_type: FxDbDriverNS.DriverType): string;
|
|
6
|
+
export declare function CHECK_TABLE_HAS_COLUMN(options: FxOrmSqlDDLSync__SQL.CheckTableHasColumnOptions, db_type: FxDbDriverNS.DriverType): string;
|
|
7
|
+
export declare function ALTER_TABLE_ADD_COLUMN(options: FxOrmSqlDDLSync__SQL.AddColumnOptions, db_type: FxDbDriverNS.DriverType): string;
|
|
8
|
+
export declare function ALTER_TABLE_RENAME_COLUMN(opts: FxOrmSqlDDLSync__SQL.AlertColumnRenameOptions, db_type: FxDbDriverNS.DriverType): string;
|
|
9
|
+
export declare function ALTER_TABLE_MODIFY_COLUMN(options: FxOrmSqlDDLSync__SQL.AlterColumnOptions, db_type: FxDbDriverNS.DriverType): string;
|
|
10
|
+
export declare function ALTER_TABLE_DROP_COLUMN(options: FxOrmSqlDDLSync__SQL.AlterColumnOptions, db_type: FxDbDriverNS.DriverType): string;
|
|
11
|
+
export declare function CREATE_INDEX(options: FxOrmSqlDDLSync__SQL.IndexOptions, db_type: FxDbDriverNS.DriverType): string;
|
|
12
|
+
export declare function DROP_INDEX(options: FxOrmSqlDDLSync__SQL.IndexOptions, db_type: FxDbDriverNS.DriverType): string;
|