aboutsummaryrefslogtreecommitdiffstats
path: root/migrations/add_is_day_wise.sql
blob: 14f694951d584d471ee2a59ce7f933834e91dbe9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
-- Migration: Add is_day_wise column to polls table
-- Run with: psql -d slotfinder -f migrations/add_is_day_wise.sql

DO $$
BEGIN
    IF NOT EXISTS (
        SELECT 1 FROM information_schema.columns
        WHERE table_name = 'polls' AND column_name = 'is_day_wise'
    ) THEN
        ALTER TABLE polls ADD COLUMN is_day_wise BOOLEAN NOT NULL DEFAULT FALSE;
        RAISE NOTICE 'Added is_day_wise column to polls table';
    ELSE
        RAISE NOTICE 'Column is_day_wise already exists';
    END IF;
END $$;