CREATE TABLE darbi (
    id INT AUTO_INCREMENT PRIMARY KEY,
    objekts VARCHAR(255) NOT NULL,
    steidzamiba VARCHAR(50) NOT NULL,
    avots VARCHAR(50) NOT NULL,
    zinotajs VARCHAR(100) NOT NULL,
    persona VARCHAR(100),
    iekarta VARCHAR(100),
    apraksts TEXT,
    piezimes TEXT,
    statuss VARCHAR(50) NOT NULL DEFAULT 'Atvērts',
    izveidots DATETIME DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE statusa_vesture (
    id INT AUTO_INCREMENT PRIMARY KEY,
    darbs_id INT NOT NULL,
    statuss VARCHAR(50) NOT NULL,
    kas_darijis VARCHAR(100),
    kad_darits DATETIME DEFAULT CURRENT_TIMESTAMP,
    ko_darijis TEXT,
    FOREIGN KEY (darbs_id) REFERENCES darbi(id) ON DELETE CASCADE
);
CREATE TABLE pielikumi (
    id INT AUTO_INCREMENT PRIMARY KEY,
    darbs_id INT NOT NULL,
    fails VARCHAR(255) NOT NULL,
    augšuupielādes_laiks DATETIME DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (darbs_id) REFERENCES darbi(id) ON DELETE CASCADE
);


