-- Execute with psql as postgres user
create user minager_admin with password 'P@ssword';
create user minager with password 'P@ssword';
create database db_minager owner minager_admin;
\c db_minager;

-- ******************************************************************
--  T A B L E S
-- ******************************************************************
drop table if exists "user";

create table "user" (
	"id"  serial,
	"key" varchar,
	"name" varchar,
	"email" varchar,
	"password" varchar,
	"image" varchar,
	"inscription_date" timestamp,
	constraint user_pk primary key ("id"),
	constraint user_key_unique unique ("key"),
	constraint user_email_unique unique ("email")
);
grant select, insert, update, delete on "user" to minager;
grant usage, select, update on user_id_seq to minager;