sql.globals.V3__create_user_tenant_right_table.sql Maven / Gradle / Ivy
CREATE TYPE RIGHT_LEVEL AS ENUM ('READ', 'WRITE', 'ADMIN');
CREATE TABLE users_tenants_rights (
username TEXT NOT NULL REFERENCES users(username) ON DELETE CASCADE ON UPDATE CASCADE,
tenant TEXT NOT NULL REFERENCES tenants(name) ON DELETE CASCADE ON UPDATE CASCADE,
level RIGHT_LEVEL NOT NULL DEFAULT 'READ',
PRIMARY KEY (username, tenant)
);