CREATE TABLE `aap_items` ( `id` int AUTO_INCREMENT NOT NULL, `dedupKey` varchar(64) NOT NULL, `titre` text NOT NULL, `categorie` enum('Handicap','PA','Enfance','Précarité','Sanitaire','Autre') NOT NULL, `region` varchar(255), `departement` varchar(255), `dateCloture` timestamp, `datePublication` timestamp, `lien` text, `importedAt` timestamp NOT NULL DEFAULT (now()), CONSTRAINT `aap_items_id` PRIMARY KEY(`id`), CONSTRAINT `aap_items_dedupKey_unique` UNIQUE(`dedupKey`) ); --> statement-breakpoint CREATE TABLE `app_settings` ( `id` int AUTO_INCREMENT NOT NULL, `key` varchar(128) NOT NULL, `value` text, `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP, CONSTRAINT `app_settings_id` PRIMARY KEY(`id`), CONSTRAINT `app_settings_key_unique` UNIQUE(`key`) ); --> statement-breakpoint CREATE TABLE `import_logs` ( `id` int AUTO_INCREMENT NOT NULL, `fileType` enum('veille','aap') NOT NULL, `source` varchar(512), `status` enum('success','partial','error') NOT NULL, `totalRows` int DEFAULT 0, `newRows` int DEFAULT 0, `skippedRows` int DEFAULT 0, `errorMessage` text, `details` json, `startedAt` timestamp NOT NULL DEFAULT (now()), `completedAt` timestamp, CONSTRAINT `import_logs_id` PRIMARY KEY(`id`) ); --> statement-breakpoint CREATE TABLE `local_users` ( `id` int AUTO_INCREMENT NOT NULL, `name` varchar(255) NOT NULL, `email` varchar(320) NOT NULL, `passwordHash` varchar(255) NOT NULL, `role` enum('admin','user','readonly') NOT NULL DEFAULT 'user', `isActive` boolean NOT NULL DEFAULT true, `createdAt` timestamp NOT NULL DEFAULT (now()), `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP, `lastSignedIn` timestamp, CONSTRAINT `local_users_id` PRIMARY KEY(`id`), CONSTRAINT `local_users_email_unique` UNIQUE(`email`) ); --> statement-breakpoint CREATE TABLE `veille_items` ( `id` int AUTO_INCREMENT NOT NULL, `dedupKey` varchar(64) NOT NULL, `titre` text NOT NULL, `categorie` varchar(128), `niveau` varchar(128), `territoire` varchar(255), `resume` text, `source` varchar(512), `passage` text, `lien` text, `typeVeille` enum('reglementaire','concurrentielle','technologique','generale') NOT NULL, `datePublication` timestamp, `importedAt` timestamp NOT NULL DEFAULT (now()), CONSTRAINT `veille_items_id` PRIMARY KEY(`id`), CONSTRAINT `veille_items_dedupKey_unique` UNIQUE(`dedupKey`) );