CREATE TABLE IF NOT EXISTS invites ( code TEXT PRIMARY KEY NOT NULL, inviter_id BIGINT NOT NULL REFERENCES users(id) ON DELETE CASCADE, guild_id BIGINT NOT NULL REFERENCES guilds(id) ON DELETE CASCADE, created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, uses INTEGER NOT NULL DEFAULT 0, max_uses INTEGER NOT NULL DEFAULT 0, max_age INTEGER NOT NULL DEFAULT 0 );