bazzar/crates/token_manager/migrations/202204131841_init.sql

28 lines
1.2 KiB
MySQL
Raw Normal View History

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
);