2022-12-20 15:34:20 +01:00
|
|
|
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
|
|
|
|
|
|
|
CREATE TYPE "Audience" AS ENUM (
|
|
|
|
'web',
|
|
|
|
'mobile',
|
|
|
|
'feed',
|
|
|
|
'admin_panel'
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TYPE "Role" AS ENUM (
|
|
|
|
'admin',
|
|
|
|
'user'
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE tokens
|
|
|
|
(
|
|
|
|
id integer NOT NULL,
|
|
|
|
customer_id uuid NOT NULL,
|
|
|
|
role "Role" NOT NULL,
|
2023-06-20 07:03:15 +02:00
|
|
|
issuer character varying DEFAULT 'myco'::character varying NOT NULL,
|
2022-12-20 15:34:20 +01:00
|
|
|
subject integer NOT NULL,
|
|
|
|
audience "Audience" DEFAULT 'web'::"Audience" NOT NULL,
|
|
|
|
expiration_time timestamp without time zone DEFAULT (now() + '14 days'::interval) NOT NULL,
|
|
|
|
not_before_time timestamp without time zone DEFAULT (now() - '00:01:00'::interval) NOT NULL,
|
|
|
|
issued_at_time timestamp without time zone DEFAULT now() NOT NULL,
|
|
|
|
jwt_id uuid DEFAULT gen_random_uuid() NOT NULL
|
|
|
|
);
|