CREATE TABLE IF NOT EXISTS canned_responses ( id SERIAL PRIMARY KEY, account_id INTEGER NOT NULL, content TEXT NOT NULL, short_code VARCHAR(255) NOT NULL, created_at TIMESTAMPTZ DEFAULT NOW(), updated_at TIMESTAMPTZ DEFAULT NOW(), deleted_at TIMESTAMPTZ ); CREATE INDEX IF NOT EXISTS idx_canned_responses_account_id ON canned_responses(account_id); CREATE UNIQUE INDEX IF NOT EXISTS idx_canned_short_code ON canned_responses(account_id, short_code) WHERE deleted_at IS NULL; CREATE INDEX IF NOT EXISTS idx_canned_responses_deleted_at ON canned_responses(deleted_at);