CREATE TABLE `exportAutomationRules` (
	`id` int AUTO_INCREMENT NOT NULL,
	`userId` int NOT NULL,
	`name` varchar(255) NOT NULL,
	`isActive` int NOT NULL DEFAULT 1,
	`priority` int NOT NULL DEFAULT 0,
	`conditionField` enum('recipientName','ventilationComptable') NOT NULL,
	`conditionValue` varchar(255) NOT NULL,
	`destinationType` enum('local','teams','sharepoint') NOT NULL,
	`destinationPath` text NOT NULL,
	`openInBrowser` int NOT NULL DEFAULT 0,
	`createdAt` timestamp NOT NULL DEFAULT (now()),
	`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
	CONSTRAINT `exportAutomationRules_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE INDEX `export_rule_user_priority_idx` ON `exportAutomationRules` (`userId`,`priority`);