-- Add scadenza_motivazione_transitoria column
DO $$ BEGIN
    IF NOT EXISTS (
        SELECT 1 FROM information_schema.columns 
        WHERE table_schema = 'public' 
        AND table_name = 'servizio' 
        AND column_name = 'scadenza_motivazione_transitoria'
    ) THEN
        ALTER TABLE public.servizio 
        ADD COLUMN scadenza_motivazione_transitoria TIMESTAMP WITHOUT TIME ZONE;
    END IF;
END $$;

-- Add skipPayment column
DO $$ BEGIN
    IF NOT EXISTS (
        SELECT 1 FROM information_schema.columns 
        WHERE table_schema = 'public' 
        AND table_name = 'servizio' 
        AND column_name = 'skipPayment'
    ) THEN
        ALTER TABLE public.servizio 
        ADD COLUMN "skipPayment" boolean NOT NULL DEFAULT FALSE;
    END IF;
END $$;

-- Add skipControlloDoc column
DO $$ BEGIN
    IF NOT EXISTS (
        SELECT 1 FROM information_schema.columns 
        WHERE table_schema = 'public' 
        AND table_name = 'servizio' 
        AND column_name = 'skipControlloDoc'
    ) THEN
        ALTER TABLE public.servizio 
        ADD COLUMN "skipControlloDoc" boolean NOT NULL DEFAULT FALSE;
    END IF;
END $$;

-- Add skipDocMotivazione column
DO $$ BEGIN
    IF NOT EXISTS (
        SELECT 1 FROM information_schema.columns 
        WHERE table_schema = 'public' 
        AND table_name = 'servizio' 
        AND column_name = 'skipDocMotivazione'
    ) THEN
        ALTER TABLE public.servizio 
        ADD COLUMN "skipDocMotivazione" boolean NOT NULL DEFAULT FALSE;
    END IF;
END $$;