route/internal/database/migrations/1513982254_tokens.up.sql

14 lines
467 B
MySQL
Raw Permalink Normal View History

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