CREATE TABLE unit_masters (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    item_category VARCHAR(80) NOT NULL,
    unit_code VARCHAR(30) NOT NULL,
    unit_name VARCHAR(50) NOT NULL,
    uom_id BIGINT UNSIGNED NULL,
    status ENUM('active', 'inactive') NOT NULL DEFAULT 'active',
    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    deleted_at TIMESTAMP NULL,
    UNIQUE KEY uq_unit_master_item_unit (item_category, unit_code),
    CONSTRAINT fk_unit_master_uom FOREIGN KEY (uom_id) REFERENCES uoms (id)
) ENGINE=InnoDB;
