36716-vm/db/migrations/041_create_discounts_table.sql
2025-12-07 05:00:42 +00:00

15 lines
470 B
SQL

CREATE TABLE IF NOT EXISTS `discounts` (
`id` INT PRIMARY KEY AUTO_INCREMENT,
`code` VARCHAR(255) NOT NULL UNIQUE,
`type` ENUM('percentage', 'fixed') NOT NULL,
`value` DECIMAL(10, 2) NOT NULL,
`start_date` DATETIME,
`end_date` DATETIME,
`uses_limit` INT,
`times_used` INT DEFAULT 0,
`is_active` BOOLEAN DEFAULT TRUE,
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);