shoutdotdev/migrations/2025-04-10-042342_invitations/up.sql

11 lines
405 B
MySQL
Raw Normal View History

2025-04-12 23:05:39 -07:00
CREATE TABLE IF NOT EXISTS team_invitations (
id UUID NOT NULL PRIMARY KEY,
team_id UUID NOT NULL REFERENCES teams(id) ON DELETE CASCADE,
email TEXT NOT NULL,
created_by UUID NOT NULL REFERENCES users(id) ON DELETE RESTRICT,
verification_code TEXT NOT NULL,
UNIQUE (team_id, email)
);
CREATE INDEX ON team_invitations(team_id);
CREATE INDEX ON team_invitations(verification_code);