Add lessons
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
-- Migration: Add activity_data column to lesson_progress
|
||||
-- This allows lessons to store custom state (e.g., SQL injection discoveries, XSS attempts, etc.)
|
||||
|
||||
ALTER TABLE lesson_progress
|
||||
ADD COLUMN activity_data JSONB DEFAULT '{}'::jsonb;
|
||||
|
||||
COMMENT ON COLUMN lesson_progress.activity_data IS 'Custom lesson-specific state data (e.g., discoveries, attempts, etc.)';
|
||||
|
||||
-- Create index for faster JSONB queries
|
||||
CREATE INDEX idx_lesson_progress_activity_data ON lesson_progress USING gin(activity_data);
|
||||
@@ -0,0 +1,4 @@
|
||||
-- Fix existing lesson_progress rows that might have NULL activity_data
|
||||
UPDATE lesson_progress
|
||||
SET activity_data = '{}'::jsonb
|
||||
WHERE activity_data IS NULL;
|
||||
@@ -0,0 +1,27 @@
|
||||
-- Migration: Add vulnerability_type column to jackpot_discoveries table
|
||||
-- Purpose: Track different Easter egg types (XSS, SQL injection, etc.)
|
||||
-- Date: 2026-02-08
|
||||
|
||||
-- Add column to distinguish vulnerability types
|
||||
ALTER TABLE jackpot_discoveries
|
||||
ADD COLUMN IF NOT EXISTS vulnerability_type VARCHAR(50) DEFAULT 'sql_injection';
|
||||
|
||||
-- Update existing constraint to allow multiple discoveries per participant
|
||||
ALTER TABLE jackpot_discoveries
|
||||
DROP CONSTRAINT IF EXISTS jackpot_discoveries_participant_id_event_id_key;
|
||||
|
||||
-- Add new unique constraint including vulnerability type
|
||||
-- This allows participants to discover multiple Easter eggs independently
|
||||
ALTER TABLE jackpot_discoveries
|
||||
DROP CONSTRAINT IF EXISTS jackpot_discoveries_unique;
|
||||
|
||||
ALTER TABLE jackpot_discoveries
|
||||
ADD CONSTRAINT jackpot_discoveries_unique
|
||||
UNIQUE (participant_id, event_id, vulnerability_type);
|
||||
|
||||
-- Create index for faster lookups
|
||||
CREATE INDEX IF NOT EXISTS idx_jackpot_vuln_type
|
||||
ON jackpot_discoveries(participant_id, event_id, vulnerability_type);
|
||||
|
||||
-- Add comment for documentation
|
||||
COMMENT ON COLUMN jackpot_discoveries.vulnerability_type IS 'Type of vulnerability discovered: xss, sql_injection, sql_filter, etc.';
|
||||
Reference in New Issue
Block a user