-- =====================================================
-- Adds type of participant to tournament
-- =====================================================

ALTER TABLE `tournaments` ADD COLUMN `participant_type` ENUM('PLAYER','TEAM') NOT NULL DEFAULT 'PLAYER' AFTER `created_at`;

ALTER TABLE `tournament_participants`
	CHANGE COLUMN `user_id` `user_id` INT(11) NULL AFTER `tournament_id`,
	ADD COLUMN `team_id` INT(11) NULL AFTER `user_id`,
	ADD CONSTRAINT `fk_tp_team` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT;
