
CREATE TABLE IF NOT EXISTS goods(
    good_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    barcode VARCHAR(16) NOT NULL UNIQUE KEY,
    label VARCHAR(40) NOT NULL
);

CREATE TABLE IF NOT EXISTS registers(
    id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    good_id INT NOT NULL,
    date DATETIME NOT NULL,
    price INT NOT NULL,
    count INT NOT NULL DEFAULT 0,
    UNIQUE (good_id, date)
);
