Update New Features
This commit is contained in:
38
migrations/add_calendar_uid.sql
Normal file
38
migrations/add_calendar_uid.sql
Normal file
@@ -0,0 +1,38 @@
|
||||
-- Migration: Add calendar_uid to events table and remove Microsoft Calendar columns
|
||||
-- Sprint 2: Universal Calendar Export
|
||||
|
||||
-- Add new calendar_uid column
|
||||
ALTER TABLE events ADD COLUMN IF NOT EXISTS calendar_uid VARCHAR;
|
||||
|
||||
-- Remove old Microsoft Calendar columns (if they exist)
|
||||
ALTER TABLE events DROP COLUMN IF EXISTS microsoft_calendar_id;
|
||||
ALTER TABLE events DROP COLUMN IF EXISTS microsoft_calendar_sync_enabled;
|
||||
|
||||
-- Verify migration
|
||||
DO $$
|
||||
BEGIN
|
||||
-- Check if calendar_uid exists
|
||||
IF EXISTS (
|
||||
SELECT 1 FROM information_schema.columns
|
||||
WHERE table_name = 'events' AND column_name = 'calendar_uid'
|
||||
) THEN
|
||||
RAISE NOTICE '✅ calendar_uid column added successfully';
|
||||
ELSE
|
||||
RAISE NOTICE '⚠️ calendar_uid column not found';
|
||||
END IF;
|
||||
|
||||
-- Check if old columns are removed
|
||||
IF NOT EXISTS (
|
||||
SELECT 1 FROM information_schema.columns
|
||||
WHERE table_name = 'events' AND column_name = 'microsoft_calendar_id'
|
||||
) THEN
|
||||
RAISE NOTICE '✅ microsoft_calendar_id column removed';
|
||||
END IF;
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT 1 FROM information_schema.columns
|
||||
WHERE table_name = 'events' AND column_name = 'microsoft_calendar_sync_enabled'
|
||||
) THEN
|
||||
RAISE NOTICE '✅ microsoft_calendar_sync_enabled column removed';
|
||||
END IF;
|
||||
END $$;
|
||||
Reference in New Issue
Block a user