@noormdev/sdk 1.0.0-alpha.35 → 1.0.0-alpha.36
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/index.js
CHANGED
|
@@ -15797,7 +15797,7 @@ async function getDialectFactory(dialect) {
|
|
|
15797
15797
|
case "mysql":
|
|
15798
15798
|
return (await import('./mysql-UPMQUBLE.js')).createMysqlConnection;
|
|
15799
15799
|
case "mssql":
|
|
15800
|
-
return (await import('./mssql-
|
|
15800
|
+
return (await import('./mssql-NIABT3Z4.js')).createMssqlConnection;
|
|
15801
15801
|
default:
|
|
15802
15802
|
throw new Error(`Unsupported dialect: ${dialect}`);
|
|
15803
15803
|
}
|
|
@@ -23632,6 +23632,15 @@ var mssqlTeardownOperations = {
|
|
|
23632
23632
|
},
|
|
23633
23633
|
dropForeignKey(constraintName, tableName, schema) {
|
|
23634
23634
|
return `ALTER TABLE ${qualifiedName3(tableName, schema)} DROP CONSTRAINT ${quote3(constraintName)}`;
|
|
23635
|
+
},
|
|
23636
|
+
dropCheckConstraints() {
|
|
23637
|
+
return [
|
|
23638
|
+
"DECLARE @noorm_drop_checks NVARCHAR(MAX) = N'';",
|
|
23639
|
+
"SELECT @noorm_drop_checks += N'ALTER TABLE ' + QUOTENAME(SCHEMA_NAME(t.schema_id)) + N'.' + QUOTENAME(t.name) + N' DROP CONSTRAINT ' + QUOTENAME(cc.name) + N';'",
|
|
23640
|
+
"FROM sys.check_constraints cc INNER JOIN sys.tables t ON cc.parent_object_id = t.object_id",
|
|
23641
|
+
"WHERE SCHEMA_NAME(t.schema_id) <> 'noorm';",
|
|
23642
|
+
"EXEC sp_executesql @noorm_drop_checks;"
|
|
23643
|
+
].join("\n");
|
|
23635
23644
|
}
|
|
23636
23645
|
};
|
|
23637
23646
|
|
|
@@ -23809,6 +23818,9 @@ async function teardownSchema(db, dialect, options = {}) {
|
|
|
23809
23818
|
dropped.foreignKeys.push(fk.name);
|
|
23810
23819
|
statements.push(ops.dropForeignKey(fk.name, tableName, fk.schema));
|
|
23811
23820
|
}
|
|
23821
|
+
if (!options.keepFunctions && ops.dropCheckConstraints) {
|
|
23822
|
+
statements.push(ops.dropCheckConstraints());
|
|
23823
|
+
}
|
|
23812
23824
|
if (!options.keepProcedures) {
|
|
23813
23825
|
for (const proc of procedures) {
|
|
23814
23826
|
dropped.procedures.push(proc.name);
|
|
@@ -24151,7 +24163,11 @@ var DbNamespace = class {
|
|
|
24151
24163
|
*/
|
|
24152
24164
|
async reset() {
|
|
24153
24165
|
checkProtectedConfig(this.#state.config, "reset");
|
|
24154
|
-
await this
|
|
24166
|
+
await teardownSchema(this.#kysely, this.#dialect, {
|
|
24167
|
+
configName: this.#state.config.name,
|
|
24168
|
+
executedBy: formatIdentity(this.#state.identity),
|
|
24169
|
+
postScript: this.#state.settings.teardown?.postScript
|
|
24170
|
+
});
|
|
24155
24171
|
if (this.#buildFn) {
|
|
24156
24172
|
await this.#buildFn({ force: true });
|
|
24157
24173
|
}
|