You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Improve interop between windows <-> linux mariadb development workflow #6972
Right now when you create migrations in Windows Maria db, migrate tends to lowercase certain statements like ALTER TABLE. Either this is a bug or we should improve the user experience here. When user tries to deploy this migration to their linux production environment, it will fail.
Suggested solution
Generate migrations with same case on every system.
Add a flag in migrations.toml that migration was generated on windows and using lowercase names and somehow fix those when migrating the same db engine on linux.
Alternatives
Warn the user about this quirk and ask them to use docker/wsl/hosted mariadb instance.
This is an artifact of how mysql lowercases table names automatically. We can write a big warning to migration files that mysql on windows behaves that way, and it's super risky if you are not deploying to a windows installation of mysql in production.
Can we somehow figure out when MySQL/MariaDB are doing that because of how they are configured? We tell them to do User but they actually do user - only in that case we could throw a fat warning or error and link people to a documentation page that explains what is going on and how to fix it. (Setting a configuration value in MySQL does fix it, right?)
It's interesting that the casing in the migration warning comment is not even consistent:
The following mihration file was just created by npx prisma migrate dev:
/* Warnings: - You are about to drop the column `redacted` on the `deviceperspective` table. All the data in the column will be lost. - Added the required column `redacted` to the `DevicePerspective` table without a default value. This is not possible if the table is not empty. - Added the required column `redacted` to the `DevicePerspective` table without a default value. This is not possible if the table is not empty. - Added the required column `redacted` to the `DevicePerspective` table without a default value. This is not possible if the table is not empty. - Added the required column `redacted` to the `DevicePerspective` table without a default value. This is not possible if the table is not empty. - Added the required column `redacted` to the `DevicePerspective` table without a default value. This is not possible if the table is not empty. - Added the required column `redacted` to the `DevicePerspective` table without a default value. This is not possible if the table is not empty. - Added the required column `redacted` to the `DevicePerspective` table without a default value. This is not possible if the table is not empty.*/-- AlterTableALTERTABLE`deviceperspective` DROP COLUMN `redacted`,
ADD COLUMN `redacted` DOUBLE NOT NULL,
ADD COLUMN `redacted`VARCHAR(9) NOT NULL,
ADD COLUMN `redacted`BOOLEANNOT NULL,
ADD COLUMN `redacted` DOUBLE NOT NULL,
ADD COLUMN `redacted` DOUBLE NOT NULL,
ADD COLUMN `redacted`BOOLEANNOT NULL,
ADD COLUMN `redacted` DOUBLE NOT NULL;
Just one question: (At least my) MariaDB on Windows ignores it if I use a PascalCase table name in my db. It works just fine.
Is anything preventing us from just using PascalCase in the migration everywhere?
Somewhere it gets conflicting information, and just runs with it.
Can you create a new bug report issue please with your description above and the additional information it asks for? Then we can look deeper into what is going on here. Thanks!
Activity
tomhoule commentedon May 19, 2021
This is an artifact of how mysql lowercases table names automatically. We can write a big warning to migration files that mysql on windows behaves that way, and it's super risky if you are not deploying to a windows installation of mysql in production.
janpio commentedon May 28, 2021
Can we somehow figure out when MySQL/MariaDB are doing that because of how they are configured? We tell them to do
Userbut they actually douser- only in that case we could throw a fat warning or error and link people to a documentation page that explains what is going on and how to fix it. (Setting a configuration value in MySQL does fix it, right?)janpio commentedon May 28, 2021
Related: #6972 (some additional information about MySQL configuration causing this potentially)
hrueger commentedon Feb 26, 2022
It's interesting that the casing in the migration warning comment is not even consistent:
The following mihration file was just created by
npx prisma migrate dev:Just one question: (At least my) MariaDB on Windows ignores it if I use a PascalCase table name in my db. It works just fine.
Is anything preventing us from just using PascalCase in the migration everywhere?
janpio commentedon Feb 26, 2022
Somewhere it gets conflicting information, and just runs with it.
Can you create a new bug report issue please with your description above and the additional information it asks for? Then we can look deeper into what is going on here. Thanks!
hrueger commentedon Feb 26, 2022
Sure! Working on it.
hrueger commentedon Feb 26, 2022
See #12053