mirror of
https://github.com/azaion/admin.git
synced 2026-04-22 10:06:33 +00:00
30 lines
931 B
SQL
30 lines
931 B
SQL
create database azaion;
|
|
-- make sure you connect to azaion db
|
|
|
|
--superadmin user
|
|
create role azaion_superadmin with login password 'superadmin_pass';
|
|
grant all privileges on all tables in schema public to azaion_superadmin;
|
|
|
|
--writer user
|
|
create role azaion_admin with login password 'admin_pass';
|
|
grant connect on database azaion to azaion_admin;
|
|
grant usage on schema public to azaion_admin;
|
|
|
|
--readonly user
|
|
create role azaion_reader with login password 'reader_pass';
|
|
grant connect on database azaion to azaion_reader;
|
|
grant usage on schema public to azaion_reader;
|
|
|
|
|
|
-- users table
|
|
create table users
|
|
(
|
|
id uuid primary key,
|
|
email varchar(160) not null,
|
|
password_hash varchar(255) not null,
|
|
hardware_id varchar(120) not null,
|
|
role varchar(20) not null
|
|
);
|
|
grant select, insert, update, delete on public.users to azaion_admin;
|
|
grant select on table public.users to azaion_reader;
|