-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Bug: PostgreSQL driver issues #4142
Comments
Not sure about the first part (I would probably have to run some tests locally) but about the second - you are using a different connection group. |
Ah, crap - sorry I've paste the wrong part of the code, probably because they are the same, this is still a playground, prod does not really means production in this case. I have amended the above, however I do not see this being the issue, since in each migration file I specify which connection group to use = 'prod' |
Okay, thanks for the explanation and more details. I made some tests on the latest develop and I couldn't reproduce these connection errors. I have some questions though. Why commenting As for a second problem with running migrations, I was able to reproduce a problem and will send a PR with a fix. It would be great if you could test it later. |
@michalsn - thanks. During the week I will run some tests and let you know the outcome |
Ok. The fix works perfectly - all migrations run without trying to recreate the tables! Now, on to the subject of the connection string. As per user manual:
I have amended the string to include username & password, just in case, even though manual says:
but the results are the same. If I try to run migration with the dsn value it crashes:
When I comment out the dsn value, then the migration runs ok, but the app crashed when trying to reach any route:
|
Ok, thanks.
We should fix the description for this note because it's valid only for the universal version of DSN (URL-like form) - which is mentioned right before the box with a note.
Well... this is a mystery to me. Sadly I can't recreate it locally. Would you be able to add
This error is strange because on a framework level we don't support PDO at all right now. Can you share what is happening on line 65 in str_repace(' ', ';', db_connect()->DSN); |
🤬🤬🤬🤬🤬 @michalsn what you said about not supporting PDO and making separate connection set of a light bulb in my head. Since the migration issue is fixed by your commit, and connection was purely my fault, I will close this issue. |
I have had this bug (well, I think it is a bug anyways - I was wrong before, plenty of times) for a while now, but was to lazy to even report it. I was just kinda working around it.
I am facing a constant issue with migrations when using postgresql.
The setup is:
Apache 2.4.46
PHP 7.4.14
PostgreSQL 13.1
My config files setup:
My .env setup:
The above setup works perfectly fine when running the app. Fetching/inserting/updating data using models or query builder is smooth and fast - no issues.
However when I try to do migration here is where the problems start:
![image](https://user-images.githubusercontent.com/14207860/105343960-35e30280-5bda-11eb-924f-8d09638435d5.png)
php spark migrate
results in the below:The workaround for this problem is to comment out the DSN part of the .env file, like so:
#database.prod.DSN = 'pgsql:dbname=playground;port=5432;host=localhost'
When I do the above, the migrations run almost perfectly. Obviously, this kills the app itself, so once I am done with migration I need to un-comment the DSN line in order to have the app working.
Now, the reason I have written almost over there, is because this work fine the first time I run migration. However when I add new migration file I get the below:
![image](https://user-images.githubusercontent.com/14207860/105344641-1e584980-5bdb-11eb-8415-2b042cf97f81.png)
Here's how my migration files look like:
![image](https://user-images.githubusercontent.com/14207860/105344777-48117080-5bdb-11eb-96c5-2bcf2621d3d7.png)
and here is the migration table in DB:
![image](https://user-images.githubusercontent.com/14207860/105344871-6d05e380-5bdb-11eb-81ce-5e62e6dfe47d.png)
As you can see, from the above screenshots, all of my previous migration files are in the database, all that is missing is the last file in the list 2021-01-20 170310_approval_workflow.php
So, why on earth is the CI trying to run the migration again for those that have clearly already been run?
The text was updated successfully, but these errors were encountered: