-- Create tablo_invitations table CREATE TABLE IF NOT EXISTS tablo_invites ( id SERIAL PRIMARY KEY, tablo_id INTEGER NOT NULL, invited_email VARCHAR(255) NOT NULL, invited_by UUID NOT NULL, invite_token TEXT NOT NULL, -- Foreign key constraint to tablos table CONSTRAINT fk_tablo_invitations_tablo_id FOREIGN KEY (tablo_id) REFERENCES tablos(id) ON DELETE CASCADE, -- Unique constraint to prevent duplicate invitations CONSTRAINT unique_tablo_invitation UNIQUE (tablo_id, invited_email) ); -- Enable Row Level Security ALTER TABLE tablo_invites ENABLE ROW LEVEL SECURITY; -- No policies for now, since we don't want to provide any access to the table