@atscript/db-mysql 0.1.137 → 0.1.139
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.cjs +6 -0
- package/dist/index.mjs +6 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1088,6 +1088,7 @@ var MysqlAdapter = class MysqlAdapter extends _atscript_db.BaseDbAdapter {
|
|
|
1088
1088
|
const conn = tx ?? await this.driver.getConnection();
|
|
1089
1089
|
const dedicated = tx === void 0;
|
|
1090
1090
|
await conn.exec("SET FOREIGN_KEY_CHECKS = 0");
|
|
1091
|
+
let originalDropped = false;
|
|
1091
1092
|
try {
|
|
1092
1093
|
const createSql = buildCreateTable(tempName, this._table.fieldDescriptors, this._table.foreignKeys, this._tableOptions());
|
|
1093
1094
|
this._log(createSql);
|
|
@@ -1112,7 +1113,12 @@ var MysqlAdapter = class MysqlAdapter extends _atscript_db.BaseDbAdapter {
|
|
|
1112
1113
|
await conn.exec(copySql);
|
|
1113
1114
|
}
|
|
1114
1115
|
await conn.exec(`DROP TABLE IF EXISTS ${quoteTableName(tableName)}`);
|
|
1116
|
+
originalDropped = true;
|
|
1115
1117
|
await conn.exec(`RENAME TABLE ${qi(tempName)} TO ${quoteTableName(tableName)}`);
|
|
1118
|
+
} catch (error) {
|
|
1119
|
+
if (originalDropped) throw new Error(`Recreate of "${tableName}" failed after the original table was dropped; its rows are in "${tempName}"`, { cause: error });
|
|
1120
|
+
await conn.exec(`DROP TABLE IF EXISTS ${qi(tempName)}`).catch(() => void 0);
|
|
1121
|
+
throw error;
|
|
1116
1122
|
} finally {
|
|
1117
1123
|
await conn.exec("SET FOREIGN_KEY_CHECKS = 1");
|
|
1118
1124
|
if (dedicated) conn.release();
|
package/dist/index.mjs
CHANGED
|
@@ -1087,6 +1087,7 @@ var MysqlAdapter = class MysqlAdapter extends BaseDbAdapter {
|
|
|
1087
1087
|
const conn = tx ?? await this.driver.getConnection();
|
|
1088
1088
|
const dedicated = tx === void 0;
|
|
1089
1089
|
await conn.exec("SET FOREIGN_KEY_CHECKS = 0");
|
|
1090
|
+
let originalDropped = false;
|
|
1090
1091
|
try {
|
|
1091
1092
|
const createSql = buildCreateTable(tempName, this._table.fieldDescriptors, this._table.foreignKeys, this._tableOptions());
|
|
1092
1093
|
this._log(createSql);
|
|
@@ -1111,7 +1112,12 @@ var MysqlAdapter = class MysqlAdapter extends BaseDbAdapter {
|
|
|
1111
1112
|
await conn.exec(copySql);
|
|
1112
1113
|
}
|
|
1113
1114
|
await conn.exec(`DROP TABLE IF EXISTS ${quoteTableName(tableName)}`);
|
|
1115
|
+
originalDropped = true;
|
|
1114
1116
|
await conn.exec(`RENAME TABLE ${qi(tempName)} TO ${quoteTableName(tableName)}`);
|
|
1117
|
+
} catch (error) {
|
|
1118
|
+
if (originalDropped) throw new Error(`Recreate of "${tableName}" failed after the original table was dropped; its rows are in "${tempName}"`, { cause: error });
|
|
1119
|
+
await conn.exec(`DROP TABLE IF EXISTS ${qi(tempName)}`).catch(() => void 0);
|
|
1120
|
+
throw error;
|
|
1115
1121
|
} finally {
|
|
1116
1122
|
await conn.exec("SET FOREIGN_KEY_CHECKS = 1");
|
|
1117
1123
|
if (dedicated) conn.release();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atscript/db-mysql",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.139",
|
|
4
4
|
"description": "MySQL adapter for @atscript/db with mysql2 driver support.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"atscript",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"@atscript/typescript": "^0.1.92",
|
|
53
53
|
"@uniqu/core": "^0.1.11",
|
|
54
54
|
"mysql2": ">=3.0.0",
|
|
55
|
-
"@atscript/db": "^0.1.
|
|
56
|
-
"@atscript/db-sql-tools": "^0.1.
|
|
55
|
+
"@atscript/db": "^0.1.139",
|
|
56
|
+
"@atscript/db-sql-tools": "^0.1.139"
|
|
57
57
|
},
|
|
58
58
|
"peerDependenciesMeta": {
|
|
59
59
|
"mysql2": {
|