14 lines
467 B
SQL
14 lines
467 B
SQL
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
|
|
|
CREATE TABLE IF NOT EXISTS Tokens
|
|
( id UUID PRIMARY KEY DEFAULT uuid_generate_v1mc()
|
|
, body VARCHAR(256) NOT NULL
|
|
, creator VARCHAR(32) NOT NULL
|
|
, scopes TEXT[] NOT NULL
|
|
, created_at TIMESTAMP NOT NULL DEFAULT NOW()
|
|
, expires_at TIMESTAMP NOT NULL
|
|
, active BOOLEAN NOT NULL DEFAULT true
|
|
);
|
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS Tokens_body on Tokens (body);
|