zitadel/migrations/cockroach/V1.1__databases.sql
Fabi 5988ec4844
fix: merge migrations (#363)
* fix: merge migrations

* fix: rename env variable
2020-07-07 16:53:54 +02:00

49 lines
1.6 KiB
SQL

CREATE DATABASE management;
CREATE DATABASE auth;
CREATE DATABASE notification;
CREATE DATABASE adminapi;
CREATE DATABASE authz;
CREATE USER management;
GRANT SELECT, INSERT, UPDATE, DELETE ON DATABASE management TO management;
GRANT SELECT, INSERT, UPDATE ON DATABASE eventstore TO management;
GRANT SELECT, INSERT, UPDATE ON TABLE eventstore.* TO management;
CREATE USER adminapi;
GRANT SELECT, INSERT, UPDATE, DELETE, DROP ON DATABASE adminapi TO adminapi;
GRANT SELECT, INSERT, UPDATE ON DATABASE eventstore TO adminapi;
GRANT SELECT, INSERT, UPDATE ON TABLE eventstore.* TO adminapi;
GRANT SELECT, INSERT, UPDATE, DROP, DELETE ON DATABASE auth TO adminapi;
GRANT SELECT, INSERT, UPDATE, DROP, DELETE ON DATABASE authz TO adminapi;
GRANT SELECT, INSERT, UPDATE, DROP, DELETE ON DATABASE management TO adminapi;
GRANT SELECT, INSERT, UPDATE, DROP, DELETE ON DATABASE notification TO adminapi;
CREATE USER auth;
GRANT SELECT, INSERT, UPDATE, DELETE ON DATABASE auth TO auth;
GRANT SELECT, INSERT, UPDATE ON DATABASE eventstore TO auth;
GRANT SELECT, INSERT, UPDATE ON TABLE eventstore.* TO auth;
CREATE USER notification;
GRANT SELECT, INSERT, UPDATE, DELETE ON DATABASE notification TO notification;
GRANT SELECT, INSERT, UPDATE ON DATABASE eventstore TO notification;
GRANT SELECT, INSERT, UPDATE ON TABLE eventstore.* TO notification;
CREATE USER authz;
GRANT SELECT, INSERT, UPDATE, DELETE ON DATABASE authz TO authz;
GRANT SELECT, INSERT, UPDATE ON DATABASE eventstore TO authz;
GRANT SELECT, INSERT, UPDATE ON TABLE eventstore.* TO authz;
GRANT SELECT, INSERT, UPDATE ON DATABASE auth TO authz;