CREATE TABLE `associations` ( `id` int AUTO_INCREMENT NOT NULL, `userId` int NOT NULL, `nomAssociation` varchar(255) NOT NULL, `siret` varchar(14), `rna` varchar(10), `adresse` text, `codePostal` varchar(10), `ville` varchar(100), `telephone` varchar(20), `emailContact` varchar(320), `siteWeb` varchar(255), `dateCreation` timestamp, `objetAssociation` text, `statutJuridique` enum('association_loi_1901','association_reconnue_utilite_publique','fondation','autre') DEFAULT 'association_loi_1901', `nomRepresentant` varchar(255), `fonctionRepresentant` varchar(100), `profileComplete` boolean DEFAULT false, `createdAt` timestamp NOT NULL DEFAULT (now()), `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP, CONSTRAINT `associations_id` PRIMARY KEY(`id`), CONSTRAINT `associations_userId_unique` UNIQUE(`userId`) ); --> statement-breakpoint CREATE TABLE `documents` ( `id` int AUTO_INCREMENT NOT NULL, `associationId` int NOT NULL, `nom` varchar(255) NOT NULL, `type` enum('statuts','recepisse_declaration','rib','rapport_activite','rapport_financier','pv_assemblee','liste_dirigeants','attestation_assurance','autre') NOT NULL, `description` text, `fileKey` varchar(512) NOT NULL, `fileUrl` varchar(1024) NOT NULL, `mimeType` varchar(100), `fileSize` int, `uploadedAt` timestamp NOT NULL DEFAULT (now()), `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP, CONSTRAINT `documents_id` PRIMARY KEY(`id`) ); --> statement-breakpoint CREATE TABLE `requestTemplates` ( `id` int AUTO_INCREMENT NOT NULL, `type` enum('subvention_fonctionnement','subvention_projet','agrement_jeunesse_education','agrement_sport','autorisation_occupation','demande_salle','autre') NOT NULL, `nom` varchar(255) NOT NULL, `description` text, `formSchema` text NOT NULL, `documentsRequis` text, `serviceDestinataire` varchar(255), `emailDestinataire` varchar(320), `actif` boolean DEFAULT true, `createdAt` timestamp NOT NULL DEFAULT (now()), `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP, CONSTRAINT `requestTemplates_id` PRIMARY KEY(`id`) ); --> statement-breakpoint CREATE TABLE `requests` ( `id` int AUTO_INCREMENT NOT NULL, `associationId` int NOT NULL, `type` enum('subvention_fonctionnement','subvention_projet','agrement_jeunesse_education','agrement_sport','autorisation_occupation','demande_salle','autre') NOT NULL, `titre` varchar(255) NOT NULL, `description` text, `formData` text, `status` enum('brouillon','soumise','en_cours_traitement','information_complementaire','validee','refusee') NOT NULL DEFAULT 'brouillon', `montantDemande` int, `montantAccorde` int, `dateSubmission` timestamp, `dateTraitement` timestamp, `traitePar` int, `commentaireAdmin` text, `documentsJoints` text, `createdAt` timestamp NOT NULL DEFAULT (now()), `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP, CONSTRAINT `requests_id` PRIMARY KEY(`id`) );