-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Description
Bug Report
Q | A |
---|---|
doctrine/orm | 3.5.0 |
doctrine/dbal | 4.3.0 |
Summary
We are using Doctrine to purely run custom migrations in legacy code base (there is no entities yet).
One of tables has Enum column, that we are converting into String via Symfony config:
doctrine:
dbal:
connections:
default:
mapping_types:
enum: string
I assume it's doing same as in Mysql Enums
When running migrations using Doctrine ORM 3.5.0, we get following error:
Doctrine\DBAL\Platforms\MySQL80Platform requires the length of a VARCHAR column to be specified
After checking the code, I see that MySQLSchemaManager::_getPortableTableColumnDefinition@179
indeed does not set any length to column.
This is not thrown in doctrine/orm:3.4.3
Table structure
CREATE TABLE `customers` (
`id` varchar(64) NOT NULL,
`master_user_id` varchar(64) NOT NULL,
`customer_type` enum('CUSTOMER_TYPE_BASIC','CUSTOMER_TYPE_MEMBER','CUSTOMER_TYPE_ACTIVE_MEMBER') DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Stack trace
[
"./vendor/doctrine/dbal/src/Platforms/AbstractPlatform.php:323 Doctrine\\DBAL\\Exception\\InvalidColumnType\\ColumnLengthRequired::new(Doctrine\\DBAL\\Platforms\\MySQL80Platform, 'VARCHAR')",
"./vendor/doctrine/dbal/src/Platforms/AbstractPlatform.php:202 Doctrine\\DBAL\\Platforms\\AbstractPlatform->getVarcharTypeDeclarationSQLSnippet(null)",
"./vendor/doctrine/dbal/src/Types/StringType.php:19 Doctrine\\DBAL\\Platforms\\AbstractPlatform->getStringTypeDeclarationSQL(array:14)",
"./vendor/doctrine/dbal/src/Platforms/AbstractPlatform.php:1486 Doctrine\\DBAL\\Types\\StringType->getSQLDeclaration(array:14, Doctrine\\DBAL\\Platforms\\MySQL80Platform)",
"./vendor/doctrine/dbal/src/Platforms/AbstractPlatform.php:2379 Doctrine\\DBAL\\Platforms\\AbstractPlatform->getColumnDeclarationSQL('', array:14)",
"./vendor/doctrine/dbal/src/Schema/Comparator.php:444 Doctrine\\DBAL\\Platforms\\AbstractPlatform->columnsEqual(Doctrine\\DBAL\\Schema\\Column, Doctrine\\DBAL\\Schema\\Column)",
"./vendor/doctrine/dbal/src/Schema/Comparator.php:196 Doctrine\\DBAL\\Schema\\Comparator->columnsEqual(Doctrine\\DBAL\\Schema\\Column, Doctrine\\DBAL\\Schema\\Column)",
"./vendor/doctrine/dbal/src/Platforms/MySQL/Comparator.php:40 Doctrine\\DBAL\\Schema\\Comparator->compareTables(Doctrine\\DBAL\\Schema\\Table, Doctrine\\DBAL\\Schema\\Table)",
"./vendor/doctrine/dbal/src/Schema/Comparator.php:62 Doctrine\\DBAL\\Platforms\\MySQL\\Comparator->compareTables(Doctrine\\DBAL\\Schema\\Table, Doctrine\\DBAL\\Schema\\Table)",
"./vendor/doctrine/migrations/src/Provider/DBALSchemaDiffProvider.php:44 Doctrine\\DBAL\\Schema\\Comparator->compareSchemas(Doctrine\\Migrations\\Provider\\LazySchema, Doctrine\\Migrations\\Provider\\LazySchema)",
"./vendor/doctrine/migrations/src/Provider/LazySchemaDiffProvider.php:50 Doctrine\\Migrations\\Provider\\DBALSchemaDiffProvider->getSqlDiffToMigrate(Doctrine\\Migrations\\Provider\\LazySchema, Doctrine\\Migrations\\Provider\\LazySchema)",
"./vendor/doctrine/migrations/src/Version/DbalExecutor.php:144 Doctrine\\Migrations\\Provider\\LazySchemaDiffProvider->getSqlDiffToMigrate(Doctrine\\Migrations\\Provider\\LazySchema, Doctrine\\Migrations\\Provider\\LazySchema)",
"./vendor/doctrine/migrations/src/Version/DbalExecutor.php:72 Doctrine\\Migrations\\Version\\DbalExecutor->executeMigration(Doctrine\\Migrations\\Metadata\\MigrationPlan, Doctrine\\Migrations\\Version\\ExecutionResult, Doctrine\\Migrations\\MigratorConfiguration)",
"./vendor/doctrine/migrations/src/DbalMigrator.php:87 Doctrine\\Migrations\\Version\\DbalExecutor->execute(Doctrine\\Migrations\\Metadata\\MigrationPlan, Doctrine\\Migrations\\MigratorConfiguration)",
"./vendor/doctrine/migrations/src/DbalMigrator.php:54 Doctrine\\Migrations\\DbalMigrator->executePlan(Doctrine\\Migrations\\Metadata\\MigrationPlanList, Doctrine\\Migrations\\MigratorConfiguration)",
"./vendor/doctrine/migrations/src/DbalMigrator.php:134 Doctrine\\Migrations\\DbalMigrator->executeMigrations(Doctrine\\Migrations\\Metadata\\MigrationPlanList, Doctrine\\Migrations\\MigratorConfiguration)",
"./vendor/doctrine/migrations/src/Tools/Console/Command/MigrateCommand.php:225 Doctrine\\Migrations\\DbalMigrator->migrate(Doctrine\\Migrations\\Metadata\\MigrationPlanList, Doctrine\\Migrations\\MigratorConfiguration)",
[...]
"./bootstrap/bootstrap.php:21 Symfony\\Component\\Console\\Application->run()",
"./bin/console:8"
]
dragosprotung
Metadata
Metadata
Assignees
Labels
No labels