Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,11 @@ class MySQLCassette {
if (options && options.clean) {
try {
let tables = await conn.raw("SHOW TABLES");
await conn.raw("SET foreign_key_checks = 0");
for (let table of tables[0]) {
await conn.raw(`DROP TABLE IF EXISTS ${table.Tables_in_track} CASCADE`);
await conn.raw(`DROP TABLE IF EXISTS ${table.Tables_in_track}`);
}
await conn.raw("SET foreign_key_checks = 1");
Comment on lines +238 to +242
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

テーブルを削除する際に、外部キーをオフにしてから、削除するようにしました。
MySQLにCASCADEがないためです。

} catch (e2) { console.error(e2); }
}
return conn;
Expand Down