-
Notifications
You must be signed in to change notification settings - Fork 39
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
'migrate' uses the wrong database #32
Comments
Did you perhaps edit your secrets file after generating the site, without adjusting the Create-Database migration (which does exactly what the name would imply)? If you prefer you can just delete this migration and create the db yourself manually with whatever username/pass combination you wish - this initial migration is just for bootstrapping so that you don't have to fiddle with the db, but it is optional if you wish to name/create a db yourself (as you seem to). |
In the code that runs the migration (https://github.com/fragmenta/fragmenta/blob/master/migrate.go#L62) you explicitly do not pass a database name. This makes psql connect to the database named after the current user, which doesn't exist on my system. I wouldn't expect to have to regenerate anything after changing the database credentials. |
OK, psql won't run a migration which consists of just creating a role and db (as this one does), so I don't see any solution to that really - you can't run psql against a db which doesn't exist yet (as is the situation when bootstrapping). I usually create the user db when creating a user to avoid exactly this sort of situation (for example your setup precludes you from just connecting to psql without specifying a database to query). I think in this situation the best solution is not to attempt to use this migration but do your own db setup with your preferred user/db name and just edit the secrets file. |
After applying the patch in #31, running
fragmenta migrate
at the top dir of my Fragmenta-CMS project gives me this output:You can see on the first line that it knows the correct database name
fragmentatest_development
. However, the 5th line shows that the wrong database namesybren
is used.The text was updated successfully, but these errors were encountered: