Skip to content
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

v2.0.0 migrations will break if 0-setup is run by a different user #57

Open
moshthepitt opened this issue Oct 5, 2020 · 1 comment
Open
Labels
bug Something isn't working

Comments

@moshthepitt
Copy link
Contributor

moshthepitt commented Oct 5, 2020

With the addition of this migrations which is meant to be run by a postgres superuser, that user ends up creating the sqitch registry schema.

Which means any other user cannot access that schema by default and so we cannot use those users to run other migrations.

This is fixed manually by running these as the supersuser (or the user who created the sqitch registry schema):

GRANT ALL PRIVILEGES ON SCHEMA sqitch_zambia_prod TO canopy;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA sqitch_zambia_prod TO canopy;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA sqitch_zambia_prod TO canopy;
GRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA sqitch_zambia_prod TO canopy;

ALTER DEFAULT PRIVILEGES FOR USER reveal IN SCHEMA sqitch_zambia_prod GRANT ALL ON TABLES TO canopy;
ALTER DEFAULT PRIVILEGES FOR USER reveal IN SCHEMA sqitch_zambia_prod GRANT ALL ON SEQUENCES TO canopy;
ALTER DEFAULT PRIVILEGES FOR USER reveal IN SCHEMA sqitch_zambia_prod GRANT ALL ON FUNCTIONS TO canopy;

We need to figure out how to work this into our migrations either on this repo, or this other one: https://github.com/onaio/ansible-sqitch-migrations

@moshthepitt moshthepitt added the bug Something isn't working label Oct 5, 2020
@ciremusyoka
Copy link
Contributor

Here is another command that maybe required to grant another user other than superuser privilege to create tables on a new DB.

GRANT CREATE ON DATABASE preview TO canopy;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants