multica/server/migrations/009_verification_code.up.sql

11 lines
353 B
SQL

CREATE TABLE verification_code (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
email TEXT NOT NULL,
code TEXT NOT NULL,
expires_at TIMESTAMPTZ NOT NULL,
used BOOLEAN NOT NULL DEFAULT FALSE,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX idx_verification_code_email ON verification_code(email, used, expires_at);