Add migration notes for later
This commit is contained in:
parent
d8609f341e
commit
faff80f7ed
53
redxen/postgresql/TODO.md
Normal file
53
redxen/postgresql/TODO.md
Normal file
@ -0,0 +1,53 @@
|
||||
# Migration TODO's / Instructions for 13->17
|
||||
|
||||
- Stop all services except DB
|
||||
- pg_dumpall from live DB
|
||||
- Init DB + Load dump manually
|
||||
- Correct permission set to be matching expectations:
|
||||
|
||||
```
|
||||
CREATE ROLE "mail" LOGIN;
|
||||
ALTER DATABASE "mail" OWNER TO "mail";
|
||||
|
||||
REASSIGN OWNED BY "postfix" TO "mail";
|
||||
DROP OWNED BY "postfix";
|
||||
DROP ROLE "postfix";
|
||||
|
||||
REASSIGN OWNED BY "dovecot" TO "mail";
|
||||
DROP OWNED BY "dovecot";
|
||||
DROP ROLE "dovecot";
|
||||
|
||||
CREATE ROLE "postfix" LOGIN;
|
||||
GRANT "mail" TO "postfix";
|
||||
CREATE ROLE "dovecot" LOGIN;
|
||||
GRANT "mail" TO "dovecot";
|
||||
|
||||
ALTER DATABASE "gitea" OWNER TO "gitea";
|
||||
|
||||
CREATE ROLE "keycloak" LOGIN;
|
||||
CREATE DATABASE "keycloak" OWNER "keycloak";
|
||||
|
||||
CREATE ROLE "exporter" LOGIN;
|
||||
GRANT "postgres" TO "exporter";
|
||||
```
|
||||
|
||||
## Quicker alternative - Modify the dump as follows
|
||||
- Delete any role creations, those are handled by the initdb
|
||||
- Revert any database creations, those are handled by the dump
|
||||
- Modify OWNER TO's to be correct
|
||||
|
||||
```
|
||||
DROP DATABASE gitea;
|
||||
DROP DATABASE grafana;
|
||||
DROP DATABASE mail;
|
||||
DROP DATABASE murmur;
|
||||
```
|
||||
|
||||
```
|
||||
< dump.sql sed \
|
||||
-e 's/OWNER TO postfix;/OWNER TO mail;/g' \
|
||||
-e 's/OWNER TO dovecot;/OWNER TO mail;/g' \
|
||||
-e 's/ALTER DATABASE gitea OWNER TO postgres;/ALTER DATABASE gitea OWNER TO gitea;/' \
|
||||
-e 's/ALTER DATABASE mail OWNER TO postgres;/ALTER DATABASE mail OWNER TO mail;/' \
|
||||
| grep -v '^CREATE ROLE .*;$' | grep -v '^ALTER ROLE .*;$'
|
||||
```
|
Loading…
Reference in New Issue
Block a user