- Add Migration 005: consent fields to groups table (display_in_workshop, consent_timestamp, management_token) - Add Migration 006: social_media_platforms and group_social_media_consents tables - Implement automatic migration execution in DatabaseManager.initialize() - Add standalone migration runner script (runMigrations.js) - Seed data: Facebook, Instagram, TikTok platforms Note: DatabaseManager statement splitting needs improvement for complex SQL. Manual migration execution works correctly via sqlite3.
17 lines
963 B
SQL
17 lines
963 B
SQL
-- Migration 005: Add consent management fields to groups table
|
|
-- Date: 2025-11-09
|
|
-- Description: Adds fields for workshop display consent, consent timestamp, and management token
|
|
|
|
-- Add consent-related columns to groups table
|
|
ALTER TABLE groups ADD COLUMN display_in_workshop BOOLEAN NOT NULL DEFAULT 0;
|
|
ALTER TABLE groups ADD COLUMN consent_timestamp DATETIME;
|
|
ALTER TABLE groups ADD COLUMN management_token TEXT; -- For Phase 2: Self-service portal
|
|
|
|
-- Create indexes for better query performance
|
|
CREATE INDEX IF NOT EXISTS idx_groups_display_consent ON groups(display_in_workshop);
|
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_groups_management_token ON groups(management_token) WHERE management_token IS NOT NULL;
|
|
|
|
-- Update existing groups to default values (retroactively grant consent for approved groups)
|
|
-- This assumes existing groups have been approved and displayed
|
|
UPDATE groups SET display_in_workshop = 1, consent_timestamp = created_at WHERE id > 0;
|