-- Migration: Replace wantsToPerform with registrationType + add isOver16 + drinkCardValue
-- Migrate existing 'wants_to_perform' data to 'registration_type' before dropping

ALTER TABLE `registration` ADD `registration_type` text NOT NULL DEFAULT 'watcher';--> statement-breakpoint
ALTER TABLE `registration` ADD `is_over_16` integer NOT NULL DEFAULT false;--> statement-breakpoint
ALTER TABLE `registration` ADD `drink_card_value` integer DEFAULT 0;--> statement-breakpoint

-- Backfill registration_type from wants_to_perform
UPDATE `registration` SET `registration_type` = 'performer' WHERE `wants_to_perform` = 1;--> statement-breakpoint
UPDATE `registration` SET `registration_type` = 'watcher' WHERE `wants_to_perform` = 0;--> statement-breakpoint

-- Backfill drink_card_value for watchers
UPDATE `registration` SET `drink_card_value` = 5 WHERE `wants_to_perform` = 0;--> statement-breakpoint

-- Create index on registration_type
CREATE INDEX `registration_registrationType_idx` ON `registration` (`registration_type`);--> statement-breakpoint

-- Drop old wants_to_perform column (SQLite requires recreating the table)
-- SQLite doesn't support DROP COLUMN directly in older versions, but Turso/libSQL does
ALTER TABLE `registration` DROP COLUMN `wants_to_perform`;
