-
-
Notifications
You must be signed in to change notification settings - Fork 388
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
Use schema config for migrations table #555
Use schema config for migrations table #555
Conversation
$table = new Table($this->migrationsTableName, $columns); | ||
$schema = new Schema([], [], $schemaManager->createSchemaConfig()); | ||
$table = $schema->createTable($this->migrationsTableName); | ||
$table->addColumn($this->migrationsColumnName, 'string', ['length' => 255]); |
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.
Can you keep the getType here ?
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.
When I change string
into Type::getType('string')
I'm getting an exception back, because \Doctrine\DBAL\Schema\Table::addColumn
method expects type as string and internally it's doing the same thing: https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Schema/Table.php#L321
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.
ok
@aik099 Thanks for the PR |
]; | ||
$table = new Table($this->migrationsTableName, $columns); | ||
$schema = new Schema([], [], $schemaManager->createSchemaConfig()); | ||
$table = $schema->createTable($this->migrationsTableName); |
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.
The build is failling because there is a space missing before the equal to align it with the one from the line above.
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.
Fixed.
0042d68
to
88b78d1
Compare
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.
@aik099 can you please add a functional test for this fix? Otherwise it's kind of hard ensure that we won't break this again in the future.
@aik099 Patch LGTM btw 👍 |
@lcobucci , any example of such test? |
Almost all commands use (and create if missing) migrations table and I've changed code, used to create it. |
Sure, but no automated test cover that specific scenario. So it means that you're not breaking existing code but you're not adding tests that ensure that in the future no one will break what you've done. Got it? |
Yes, none of the tests likely check actual structure of the table being created after the |
I thinking to a test where you would pass a schema where you changed the charset and you verify that after execution it's that charset that was used for the new code. I will try that tomorrow. |
@mikeSimonson , did it work, I mean idea about new test? |
@aik099 I taught that you where going to take a look at it. If you can't, just tell me and I will try. |
Yeah, I can't, because I haven't found any tests that are using MySQL or similar database engine where we can actually dump database structure and verify that it was using correct collation, charset and type (InnoDB or MyISAM). |
Since master has changed so much since this PR was originally created, I continued the work for this in #679 |
When creating
migration_versions
table use same table options (e.g.charset
,collate
andengine
), that are used during migration diff generation.Solves the problem, where
doctrine.dbal.default_table_options
setting wasn't respected by https://github.com/doctrine/DoctrineMigrationsBundle.