-- Adds public sharing columns to forms table
ALTER TABLE forms
    ADD COLUMN IF NOT EXISTS share_scope VARCHAR(16) NOT NULL DEFAULT 'none',
    ADD COLUMN IF NOT EXISTS share_slug TEXT,
    ADD COLUMN IF NOT EXISTS share_enabled BOOLEAN NOT NULL DEFAULT FALSE,
    ADD COLUMN IF NOT EXISTS share_published_at TIMESTAMPTZ;

CREATE UNIQUE INDEX IF NOT EXISTS forms_share_slug_unique ON forms(share_slug) WHERE share_slug IS NOT NULL;
