dnd-hub/apps/server/src/db/migrations/007_dndbeyond_sync.sql
2026-03-16 22:15:15 -04:00

7 lines
390 B
SQL

-- Adds D&D Beyond sync columns to the characters table.
ALTER TABLE characters ADD COLUMN dndbeyond_id TEXT;
ALTER TABLE characters ADD COLUMN dndbeyond_last_sync TEXT;
-- Prevent two entries for the same DnD Beyond character ID within the same campaign
CREATE UNIQUE INDEX IF NOT EXISTS idx_characters_dndbeyond
ON characters(campaign_id, dndbeyond_id) WHERE dndbeyond_id IS NOT NULL;