CREATE TABLE `automationRules` ( `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, `conditions` text NOT NULL, `conditionsLogic` enum('AND','OR') NOT NULL DEFAULT 'AND', `actions` text NOT NULL, `createdAt` timestamp NOT NULL DEFAULT (now()), `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP, CONSTRAINT `automationRules_id` PRIMARY KEY(`id`) );