CREATE TABLE `masse_salariale_remunerations` (
	`id` int AUTO_INCREMENT NOT NULL,
	`salarieId` int NOT NULL,
	`annee` int NOT NULL,
	`salaireAnnuelBrutHorsPrimesCents` int NOT NULL,
	`salaireAnnuelBrutAvecPrimesCents` int NOT NULL,
	`salaireMensuelBrutHorsPrimesCents` int NOT NULL,
	`tauxChargeBps` int NOT NULL,
	`evolutionSalarialeBps` int,
	`periodeReference` varchar(7),
	`source` varchar(64) NOT NULL DEFAULT 'bulletin',
	`createdAt` timestamp NOT NULL DEFAULT (now()),
	`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
	CONSTRAINT `masse_salariale_remunerations_id` PRIMARY KEY(`id`),
	CONSTRAINT `masse_salariale_salarie_annee_idx` UNIQUE(`salarieId`,`annee`)
);
--> statement-breakpoint
CREATE TABLE `masse_salariale_salaries` (
	`id` int AUTO_INCREMENT NOT NULL,
	`matricule` varchar(32) NOT NULL,
	`nom` varchar(150) NOT NULL,
	`prenom` varchar(150) NOT NULL,
	`poste` varchar(255) NOT NULL,
	`dateEmbauche` varchar(10) NOT NULL,
	`actif` boolean NOT NULL DEFAULT true,
	`createdAt` timestamp NOT NULL DEFAULT (now()),
	`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
	CONSTRAINT `masse_salariale_salaries_id` PRIMARY KEY(`id`),
	CONSTRAINT `masse_salariale_salaries_matricule_unique` UNIQUE(`matricule`)
);
