CREATE TABLE `salaires_bulletins` (
	`id` int AUTO_INCREMENT NOT NULL,
	`liasseId` int NOT NULL,
	`matricule` varchar(32) NOT NULL,
	`nom` varchar(150) NOT NULL,
	`prenom` varchar(150) NOT NULL,
	`poste` varchar(255) NOT NULL,
	`brutMensuelCents` int NOT NULL,
	`brutAvecPrimesCents` int NOT NULL,
	`primeAstreinteCents` int NOT NULL DEFAULT 0,
	`explicationEcart` text,
	`numeroPage` int,
	`createdAt` timestamp NOT NULL DEFAULT (now()),
	`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
	CONSTRAINT `salaires_bulletins_id` PRIMARY KEY(`id`),
	CONSTRAINT `salaires_bulletins_liasse_matricule_idx` UNIQUE(`liasseId`,`matricule`)
);
--> statement-breakpoint
CREATE TABLE `salaires_liasses` (
	`id` int AUTO_INCREMENT NOT NULL,
	`annee` int NOT NULL,
	`mois` int NOT NULL,
	`nomFichier` varchar(255) NOT NULL,
	`stockageKey` varchar(512) NOT NULL,
	`empreinteSha256` varchar(64) NOT NULL,
	`tailleOctets` int NOT NULL,
	`ivBase64` varchar(32) NOT NULL,
	`authTagBase64` varchar(32) NOT NULL,
	`versionCle` int NOT NULL DEFAULT 1,
	`importePar` int NOT NULL,
	`importeLe` timestamp NOT NULL DEFAULT (now()),
	CONSTRAINT `salaires_liasses_id` PRIMARY KEY(`id`),
	CONSTRAINT `salaires_liasses_stockageKey_unique` UNIQUE(`stockageKey`),
	CONSTRAINT `salaires_liasses_empreinteSha256_unique` UNIQUE(`empreinteSha256`),
	CONSTRAINT `salaires_liasses_periode_empreinte_idx` UNIQUE(`annee`,`mois`,`empreinteSha256`)
);
