-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Support UUID data type for MySQL 8.0+ and MariaDB 10.7+ #2674
Comments
Unfortunately we only support 1 schema file per database. It is possible to detect the db version before the |
Agree, just moving forward and require proper versions of MySQL/MariaDB that support the UUID data type seems OK to me too. I don't have very high traffic sites right now and the degradation using VARCHAR(36) was noticeable to the point we observed timeouts (i.e. when deleting a site or just asking for data), so I gave a try and manually converting to UUID all of the column IDs and references really worked like a charm. Anyway I understand this could require some testing for the initial structure and migrations. I can try help with MariaDB and MySQL, drop me a message and I can try to help / test. |
A quick warning about this, because it isn't totally accurate. There are two issues :
varchar isn't probably the ideal solution, but I don't think there's an easy alternative at the moment. |
Describe the feature or enhancement
Is it possible to support prisma migrations / table structs for specific versions of MySQL / MariaDB? Or require at least mysql and mariadb versions that support UUID data type...
MySQL 8.0 and MariaDB 10.7 added support for UUID data type respectively. MariaDB 10.11 is the current LTS for MariaDB and 8.0 is the current LTS for MySQL.
The data type to use is UUID, instead of VARCHAR(36) which is a performance and storage killer despite the "compatibility" it offers. The varchar 'hack' works for some thousands of referenced rows in umami, but severely degrades once you have more, leaving you thinking your only option is to migrate to PosgreSQL instead of using MySQL or MariaDB.
The only required change is use UUID instead of VARCHAR(36) on table structs where an ID primary key or a reference to one is needed.
This also make the migration at v2.11.0 more simpler -and in order to work if you have UUID-. So the file (
db/mysql/migrations/05_add_visit_id/migration.sql
) fails:Instead of
BIN_TO_UUID(RANDOM_BYTES(16) & 0xffffffffffff0fff3fffffffffffffff | 0x00000000000040008000000000000000) uuid
you can simply useUUID() as uuid
(I had to rollback the failed migration and amend it to make it work once you have UUID data type...)Thanks.
The text was updated successfully, but these errors were encountered: