ddev-intellij-plugin
ddev-intellij-plugin copied to clipboard
Database connection gets reset, losing existing console and commands
Is there an existing issue for this?
- [X] I have searched the existing issues
Are you sure that this bug is related to this DDEV Integration Plugin?
- [X] I am sure
Enter your error report ID (If available)
No response
Describe the bug
When I stop working on a project and have commands in the database console, they are lost on the next time I start DDEV. It appears the database connection gets recreated instead of updating the port.
Steps to reproduce
- Open PhpStorm for project
- Run
ddev start
- Open a query console
- Perform a query with the console.
- Run
ddev poweroff
- Close PhpStorm
- Reopen PhpStorm
- Open query console, see previous command
- Run
ddev start
- See open query console tab close, when reopened all contents lost
Additional context
No response
I haven't used the PhpStorm console much, but remember that DDEV does have history in the mysql
shell, so you can review and reissue your commands there. The history persists until you delete the project.
Since the port changes for the connection on ddev restart
or ddev poweroff
, I'm not at all sure one could resume a new session on the new port. Remember that the server is completely new in that case (even though it has database and command-line history stored).
However, related:
- https://github.com/ddev/ddev/issues/3566
But even with the exact same port I'm not sure you could resume a session, but I'll bet you know more about this than I do.
Before using this plugin I would manually edit the port, and everything was fine. I think this plugin is recreating the database connection configuration which causes the issue. It's not the end of the world, but it's a minor annoyance. I was going to dig in and see if I can figure it out
It's right here: https://github.com/php-perfect/ddev-intellij-plugin/blob/main/src/main/java/de/php_perfect/intellij/ddev/database/DdevDataSourceManagerImpl.java#L22-L29
if (currentLocalDataSource.getName().equals(dataSource.getName())) {
localDataSourceManager.removeDataSource(currentLocalDataSource);
}
It does remove the data source to re-add
localDataSourceManager.addDataSource(dataSource);
I don't know the details, but maybe we can just update the connection string instead of a full removal and addition.
This week I'll go through https://github.com/php-perfect/ddev-intellij-plugin/blob/main/CONTRIBUTING.md#development and see if I can get a PR created.
Hi @mglaman, Yes the data source is currently recreated. A PR is very welcome! If you need any assistance, please let me know.
I did it myself as I wanted to publish a new release today. Please let me know if this fixed your issues, @mglaman. The release 1.1.0 is currently pending JetBrains review and should be available in the store within the next few days. You can already download the new plugin version as zip attached to the release.
But the configuration won't be equal because the port changes on each start. I'll work on a fix to try and only update the connection string still.
@mglaman, you're right I missed that point. I'm reopening that issue.
@mglaman are you still interested in providing a pull request? Would be great to solve this issue in a better way! :)
This seems like a resolved issue to me.
Not sure it's resolved, but not sure if it's worth chasing either. I would think that existing things would be lost on a new port, for example (after ddev restart
)
IntelliJ DB console works perfectly fine on persisting existing consoles if you update the connection details.