Skip to content

Conversation

@Syogo-Suganoya
Copy link
Contributor

@Syogo-Suganoya Syogo-Suganoya commented Jun 27, 2025

#53

@Syogo-Suganoya Syogo-Suganoya self-assigned this Jun 27, 2025
@Syogo-Suganoya Syogo-Suganoya linked an issue Jun 27, 2025 that may be closed by this pull request
Copy link
Contributor Author

@Syogo-Suganoya Syogo-Suganoya left a comment

Choose a reason for hiding this comment

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

@a-miyashita review me
タグは v2.6.0-rc8 でつけています。
一応、ローカルで動作確認済みです。

Options:
--clean Remove all objects before execution.
-c --client <client> Kind of Database Client [sqlite, postgres; default sqlite]
-c --client <client> Kind of Database Client [sqlite, postgres, mysql; default sqlite]
Copy link
Contributor Author

@Syogo-Suganoya Syogo-Suganoya Jun 27, 2025

Choose a reason for hiding this comment

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

debugコマンドのUSAGEのclientオプションにmysqlを追加しました。

Comment on lines +238 to +242
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");
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がないためです。

Comment on lines -280 to +287
kcu.column_name AS column,
ccu.table_name AS foreign_table,
ccu.column_name AS foreign_column
FROM information_schema.table_constraints AS tc
INNER JOIN information_schema.key_column_usage AS kcu ON tc.constraint_name = kcu.constraint_name
INNER JOIN information_schema.constraint_column_usage AS ccu ON ccu.constraint_name = tc.constraint_name
WHERE tc.constraint_type = 'FOREIGN KEY' AND tc.table_name = '${table}'
COLUMN_NAME AS \`column\`,
REFERENCED_TABLE_NAME AS foreign_table,
REFERENCED_COLUMN_NAME AS foreign_column
FROM information_schema.KEY_COLUMN_USAGE
WHERE
TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = '${table}'
AND REFERENCED_TABLE_NAME IS NOT NULL
Copy link
Contributor Author

Choose a reason for hiding this comment

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

listFkのSQL文をMySQLのものに修正しました。

}
updateAutoIncrementSql(table, column) {
return `ALTER TABLE ${table} AUTO_INCREMENT = ? + 1`;
return `ALTER TABLE ${table} AUTO_INCREMENT = ?`;
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ではプレースホルダを使った計算式はエラーが出るようなので、+1を削除しました。
updateAutoIncrement の方で、MySQLCassetteの場合のみ、count+1するようにしました。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

既存のSQLiteチャレンジでも、影響なく正常に動作することを確認です。

Copy link
Collaborator

@a-miyashita a-miyashita left a comment

Choose a reason for hiding this comment

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

修正ありがとうございます。これで完成となったら version の rc を取ってリリースしてください。リリース用の PR は僕のレビューは不要です。

@a-miyashita a-miyashita merged commit 14c7fd2 into main Jun 28, 2025
7 checks passed
@a-miyashita a-miyashita deleted the fix/#53 branch June 28, 2025 02:01
@a-miyashita
Copy link
Collaborator

リリース僕の方でやりました

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MySQL修正

3 participants