Ensure generate_schema EXACTLY the same as SHOW CREATE TABLE in MySQL
See original GitHub issueDescribe the bug
As you may know, I’m working on a schema sync to MySQL which should work with Tortoise ORM. For this to work good the schema that Tortoise generate should be as close to the result of SHOW CREATE TABLE
as possible. Now it works quite well, though I still have a problem with unique_together.
To Reproduce See the example in #215 . The generated SQL is semantically good, though MySQL will give a name to the unique key, which is the name of the 1st field it uses. But if you have another key with that name, it will add a number to it. So it is not deterministic enough.
Expected behavior It should look like this:
UNIQUE KEY `key_user_id_62ed175d` (`key`, `user_id`)
Additional context
Also the full command has the KEY
keyword, tortoise generates code without it, though I could resolve it with regexp in my schema sync.
I still need a similar custom schema generator described in #215 to solve this.
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (14 by maintainers)
Top GitHub Comments
I agree with you, 64KB is small for a lot of tasks. MySQL is the oldest engine of them, and it can work on very low end hw, this is why they leave it configurable this way.
Though I can’t imagine a situation where it is useful to store a whole DVD in a DB column. It would be very slow. These are only theoretical values. It is useful to store pictures, PDF-s and similar things in DB columns which is very common. So I think option 2 is the way to go, which makes tortoise-mysql similar to other engines.
Release v0.15.2 should have the fix for this. Please test and confirm.