~willvaughn/grsroot-auth

ref: e468639d9f413fac8c862fc85beb3840b8468796 grsroot-auth/resources/migrations/20220211035117-grsroot-auth.up.sql -rw-r--r-- 1.1 KiB
e468639dWilliam Vaughn make created_at with time zone in db, mock in fake API with instant 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
create table app_user (
  app_user_id uuid primary key default gen_random_uuid(),
  email       character varying(320) unique not null,
  password    text not null,
  created_at  timestamp with time zone not null default now()
);
--;;
create table app (
  app_id   uuid primary key default gen_random_uuid(),
  app_slug character varying(60) unique not null
);
--;;
create table app_role (
  app_role_id uuid primary key default gen_random_uuid(),
  app_id      uuid not null references app(app_id),
  role_slug   character varying(60) not null,
  unique(app_id, role_slug)
);
--;;
create table app_user_role (
  app_user_role_id bigserial primary key,
  app_user_id      uuid not null references app_user(app_user_id),
  app_role_id      uuid not null references app_role(app_role_id),
  unique(app_user_id, app_role_id)
);
--;;
create table refresh_token (
  refresh_token_id bigserial primary key,
  app_user_id      uuid not null references app_user(app_user_id),
  issued_at        timestamp with time zone not null,
  token            text not null,
  is_valid         boolean not null
);