[
  {
    "type": "create_table",
    "description": "Create buys table in kiosk_sales database for tracking buy items from POS",
    "database": "kiosk_sales",
    "check_query": "SELECT 1 FROM information_schema.tables WHERE table_schema = 'kiosk_sales' AND table_name = 'buys'",
    "sql": "CREATE TABLE IF NOT EXISTS `buys` (`id` int(11) NOT NULL AUTO_INCREMENT, `code` varchar(50) NOT NULL, `buyDate` date DEFAULT NULL, `description` varchar(255) DEFAULT NULL, `quantity` int(11) DEFAULT 0, `price` decimal(10,2) DEFAULT 0.00, `cost` decimal(10,2) DEFAULT 0.00, `deptID` varchar(20) DEFAULT NULL, `catID` varchar(20) DEFAULT NULL, `subCatID` varchar(20) DEFAULT NULL, `sizeID` varchar(20) DEFAULT NULL, `brandID` varchar(20) DEFAULT NULL, `typeNum` varchar(10) NOT NULL, `createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `code_typeNum_unique` (`code`, `typeNum`), KEY `typeNum` (`typeNum`), KEY `buyDate` (`buyDate`), KEY `deptID` (`deptID`), KEY `catID` (`catID`), KEY `brandID` (`brandID`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;"
  }
]
