-
Notifications
You must be signed in to change notification settings - Fork 45
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
SQLSTATE[HY000]: General error: 1 table messenger_messages already exists #103
Comments
You can use that setting to disable the automatic creation of tables: liip_test_fixtures:
keep_database_and_schema: true |
I actually thinks this is the reason. Ill try and test it at a later point. |
@lsv Did the fix in Symfony solved your problem? |
@alexislefebvre I have same problem if I use automatic creation of tables. |
@kolotov I don't have any other solution right one than using |
Here's my research into this. I have a set of tests, the first test runs fine, and then the next test blows up trying to create messenger_messages, which already exists. Ultimate cause:ORMSqliteDatabaseTool - lines 92-94 - dropDatabase and createSchema are not symmetrical Problem overview
Cause
Looks like these SchemaSubscribers were added to symfony/doctrine-bridge in 5.1 (SchemaListener directory appears at 5.1) Thoughts
ConclusionNot much I can do to workaround - this is caused by code in symfony/doctrine-bridge, and behaviour could be adjusted if I could hook into SchemaTool, but that's in doctrine/orm. I'm going to have to do the whole keep_databases_and_schema thing, right? :/ |
@WubbleWobble thanks for the detailed report! Calling Update: actually it looks like it's only used when purging the tables, it may not help here. |
@alexislefebvre Thanks - I found that method, but as you say - it didn't actually help :) I would open a bug report with doctrine and/or symfony, but honestly I'm quite confused by many aspects of it, and where the "blame" (for lack of a better word) lies. It's going to take some more investigation I think! I ended up using keep_databases_and_schema: true, and used a phpunit bootstrap file to run the various Symfony console commands needed to set up the test database. |
Sorry but I'm not sure where should I put this yaml configuration - should I create a new file config/packages/liip.yaml? |
@Ceriusz yes, there is an example of path here: https://github.com/liip/LiipTestFixturesBundle/blob/2.x/doc/configuration.md |
Hello, I have the same problem. As a workaround, I deleted the global transport configuration and added it only to the dev and prod environments. For testing I used test://. example ## Configuration messenger
## Commun environment configuration
framework:
messenger:
routing:
'App\Message\AsyncMessageInterface': async
buses:
command_bus:
middleware:
- router_context
transports:
async:
options:
queue_name: aqueuename
# prod environment
when@prod:
framework:
messenger:
transports:
async: 'doctrine://default'
# Test environment
when@test:
framework:
messenger:
transports:
async: 'test://' I hope this can help someone. |
After an upgrade from symfony 4.4 to symfony 5.1 with all the doctrine dependencies, and also an remove of
liip/functional-test-bundle
and instead install ofliip/test-fixtures-bundle
Some dependencies that have been upgraded is
My tests began to output a lot of
SQLSTATE[HY000]: General error: 1 table messenger_messages already exists
all over the place.Now for my migrations to not add
messenger_messages
table I have the following doctrine configSo to fix my
table already exists
I had to add the following to my doctrine test yaml fileAnd now my tests are running fine.
Im not actually sure this is a bug in either doctrine or liip, but just wanted to add it somewhere, so it can be googled - because I had no relevant google results coming up.
The text was updated successfully, but these errors were encountered: