feat: drop all connections before dropping db for postgres#458
feat: drop all connections before dropping db for postgres#458nikophil merged 1 commit intozenstruck:1.xfrom
Conversation
d2fdff2 to
7a3a730
Compare
Yes I w'll test |
src/Test/ORMDatabaseResetter.php
Outdated
| private function dropAndResetDatabase(): void | ||
| { | ||
| foreach ($this->connectionsToReset() as $connection) { | ||
| if ($this->registry->getConnection($connection)->getDatabasePlatform() instanceof PostgreSQLPlatform) { |
There was a problem hiding this comment.
working for me with the class PostgreSQL100Platform.
the class is deprecated but the newer class isn't working yet.
Deprecated:
This class will be merged with PostgreSQLPlatform in 4.0 because support for Postgres releases prior to 10.0 will be dropped.
Suggest: inplement with an OR clause ..
There was a problem hiding this comment.
hi @benblub
thanks for having tested that!
Suggest: inplement with an OR clause ..
not sure to understand what you mean?
There was a problem hiding this comment.
if ($this->registry->getConnection($connection)->getDatabasePlatform() instanceof PostgreSQLPlatform || $this->registry->getConnection($connection)->getDatabasePlatform() instanceof PostgreSQL100Platform)There was a problem hiding this comment.
I've not done this because PostgreSQL100Platform extends PostgreSQLPlatform
There was a problem hiding this comment.
ok then just replace PostgreSQLPlatform with PostgreSQL100Platform. In my test PostgreSQL100Platform is working and PostgreSQLPlatform not.
There was a problem hiding this comment.
I really don't understand what's going on: https://github.com/zenstruck/foundry/actions/runs/5000161439/jobs/8957237306
I changed the CI to have only ONE job with postgres, and the db is named zenstruck_foundry_${{ matrix.use-dama }}_${{ matrix.orm-db }}, ie: zenstruck_foundry_1_postgres so it is unique in the matrix...
what I've noticed is also that the CI with postgres works without dama... 🤔
There was a problem hiding this comment.
what I've noticed is also that the CI with postgres works without dama...
Ok, that was exactly the issue in #73. Worked without dama but not with.
There was a problem hiding this comment.
I managed to make dama work with postgres in GH CI: we must add ?serverVersion=15 in the dsn
There was a problem hiding this comment.
Sheesh, ok that matches the recipe
There was a problem hiding this comment.
ok then, the CI is green with postgres as the main db engine!
this was... painful 😅
benblub
left a comment
There was a problem hiding this comment.
working for me with PostgreSQL100Platform.
the class is deprecated but the newer class isn't working yet.
Deprecated:
This class will be merged with PostgreSQLPlatform in 4.0 because support for Postgres releases prior to 10.0 will be dropped.
Suggest: inplement with an OR clause ..
797ec7e to
ff7c95b
Compare
c12fd51 to
85fa025
Compare
2444ab0 to
56cb31a
Compare
| * @test | ||
| */ | ||
| public function it_generates_a_valid_schema(): void | ||
| public function it_can_use_schema_reset_with_migration(): void |
There was a problem hiding this comment.
I don't know why, but in some case, when this test class used to have 2 tests, the second one was failing. Hence why I merged them
56cb31a to
a56c88f
Compare
a56c88f to
1511940
Compare
kbond
left a comment
There was a problem hiding this comment.
good to go after the mysql jobs are added as discussed!
fixes #455
we cannot test this, since we use mysql in docker images, I'll test it in a project of mine
EDIT: it does not work on my project, but I don't know why...
SELECT current_database()gives me the good database name 🤷♂️@benblub would you mind to test it on a project of yours? 🙏 maybe it's coming from my setup...