-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Virtual columns will always have schema changes when checked with orm:schema-tool:update
#9408
Comments
What version of DBAL are you using? Older versions will always cause a change with |
I'm currently on v2.13.7 so that might explain it. I'll try (force-)updating it to check if it happens in the latest version. |
@beberlei I've managed to update to doctrine/dbal 3.3.0. The result for the "website" example is still the same. In addition, another column manually defined as #[Entity]
class Website
{
#[Column(
type: 'string',
insertable: false,
updatable: false,
columnDefinition: "VARCHAR(255) GENERATED ALWAYS AS ('foo') VIRTUAL",
generated: 'ALWAYS'
)]
private ?string $url = null;
#[Column(type: 'string', nullable: true, columnDefinition: "ENUM('preparing', 'pending', 'approved', 'rejected') DEFAULT NULL")]
private ?string $status = null;
}
ALTER TABLE website CHANGE url url VARCHAR(255) GENERATED ALWAYS AS ('foo') VIRTUAL, CHANGE status status ENUM('foo', 'bar') DEFAULT NULL; |
@villermen For your |
Adding |
@villermen In case of the On a related note: |
@bcremer Thanks for the pointer! Looks like it triggered completely unrelated to I've fixed it by changing VARCHAR(255) GENERATED ALWAYS AS ('foo') VIRTUAL NOT NULL to bring it in line with the Having to figure it out like this is pretty cumbersome, so I'm all in favor of the debug/verbose mode suggested by @bcremer. But this issue is definitely invalid because it has nothing to do with the column being virtual. Thanks for your help! |
Unfortunately the new https://github.com/doctrine/dbal/releases/tag/3.3.1 release and doctrine/dbal#5220 makes it impossible to use |
Bug Report
Summary
A virtual column defined via the new capabilities of v2.11 will always have changes when checked with the
orm:schema-tool:update
console command.How to reproduce
Consider the following mapping on a MySQL 8 database:
Running
orm:schema-tool:update --dump-sql --force
consecutively will always yield the change:Expected behavior
Expected behavior is to either compare the column definition from the database with the schema, or ignore it completely and only check column existence when it has a custom definition. Both situations would lead to the changes being generated only once.
The text was updated successfully, but these errors were encountered: