ALTER TABLE resource_policies
    ADD COLUMN IF NOT EXISTS clipboard_mode TEXT NOT NULL DEFAULT 'disabled';

UPDATE resource_policies
SET clipboard_mode = CASE
    WHEN clipboard_enabled THEN 'bidirectional'
    ELSE 'disabled'
END
WHERE clipboard_mode = 'disabled';

ALTER TABLE resource_policies
    DROP CONSTRAINT IF EXISTS resource_policies_clipboard_mode_check;

ALTER TABLE resource_policies
    ADD CONSTRAINT resource_policies_clipboard_mode_check
    CHECK (clipboard_mode IN ('disabled', 'client_to_server', 'server_to_client', 'bidirectional'));
