-
Notifications
You must be signed in to change notification settings - Fork 1
MySQL修正 #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MySQL修正 #58
Conversation
Syogo-Suganoya
left a comment
There was a problem hiding this 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] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debugコマンドのUSAGEのclientオプションにmysqlを追加しました。
- issue: debugコマンドのclientオプションのUSAGE修正
- commit: 70515bd
| 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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
テーブルを削除する際に、外部キーをオフにしてから、削除するようにしました。
MySQLにCASCADEがないためです。
- issue: 外部キー使用で、debug --clean実行時にUNKNOWN_CODE_PLEASE_REPORT
- commit: 7e9bed9
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
listFkのSQL文をMySQLのものに修正しました。
- issue: 外部キー使用で、table実行時にlistFkでER_PARSE_ERROR
- commit: db174e0
| } | ||
| updateAutoIncrementSql(table, column) { | ||
| return `ALTER TABLE ${table} AUTO_INCREMENT = ? + 1`; | ||
| return `ALTER TABLE ${table} AUTO_INCREMENT = ?`; |
There was a problem hiding this comment.
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するようにしました。
- issue: auto_incrementでER_PARSE_ERROR
- commit: 87990f6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
既存のSQLiteチャレンジでも、影響なく正常に動作することを確認です。
a-miyashita
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修正ありがとうございます。これで完成となったら version の rc を取ってリリースしてください。リリース用の PR は僕のレビューは不要です。
|
リリース僕の方でやりました |
#53