CREATE TABLE `datesFormation` (
	`id` int AUTO_INCREMENT NOT NULL,
	`sequenceId` int NOT NULL,
	`dateDebut` datetime NOT NULL,
	`dateFin` datetime NOT NULL,
	`ordre` int NOT NULL,
	`createdAt` timestamp NOT NULL DEFAULT (now()),
	CONSTRAINT `datesFormation_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `sequences` (
	`id` int AUTO_INCREMENT NOT NULL,
	`formationId` int NOT NULL,
	`nom` varchar(255) NOT NULL,
	`lieu` varchar(500) NOT NULL,
	`capaciteMax` int NOT NULL DEFAULT 12,
	`dateBlocage` datetime NOT NULL,
	`statut` enum('ouverte','bloquee','terminee') NOT NULL DEFAULT 'ouverte',
	`createdAt` timestamp NOT NULL DEFAULT (now()),
	`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
	CONSTRAINT `sequences_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
DROP TABLE `sessions`;--> statement-breakpoint
ALTER TABLE `inscriptions` DROP INDEX `inscriptions_apprenantId_sessionId_unique`;--> statement-breakpoint
ALTER TABLE `inscriptions` MODIFY COLUMN `statut` enum('confirmee','liste_attente','annulee') NOT NULL;--> statement-breakpoint
ALTER TABLE `inscriptions` ADD `sequenceId` int NOT NULL;--> statement-breakpoint
ALTER TABLE `inscriptions` DROP COLUMN `sessionId`;--> statement-breakpoint
ALTER TABLE `inscriptions` DROP COLUMN `invitationEnvoyee`;--> statement-breakpoint
ALTER TABLE `inscriptions` DROP COLUMN `emailConfirmationEnvoye`;--> statement-breakpoint
ALTER TABLE `inscriptions` DROP COLUMN `emailTeaserEnvoye`;--> statement-breakpoint
ALTER TABLE `inscriptions` DROP COLUMN `emailRappelEnvoye`;