-
-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
db:create erroneously states database already exists when connecting to timescaledb #1693
Comments
What Shlink does in order to determine if the database exists is checking if any table which is not the migrations table itself, already exists in the database. I have considered a few times changing the approach, as it's a bit naive, because the database could have other tables (which is probably what is happening here), but checking exactly for Shlink tables has some considerations:
|
Yeah its a tricky one. I think the interesting thing in this case is that in the public schema, there are no other tables. So its doing its check for tables in the other schemas. if we just restrict the scope to public this logic will be correct again. |
Yeah, that's a good point. I will check if that's actually what's happening. |
I have found a way to make Shlink check for its actual tables only, in a dynamic way (I don't need to change anything if the tables change, more are added, etc), which should cover this problem, as foreign tables will not affect this command anymore. |
Shlink 3.5.2 was released yesterday, including this fix. |
How Shlink is set up
Summary
When connecting to a timescaledb postgresql instance the db:create cli function states the database already exists, which it does not. db:migrate then fails due to missing tables.
Expected behavior
db:create would create the tables
How to reproduce
Run the stable container pointing at a timescaledb (pg14) instance.
I suspect its seeing something in the non public schemas thats causing it to stop? timescaledb creates a number of other schemas alongside public.
The text was updated successfully, but these errors were encountered: