CREATE TABLE IF NOT EXISTS llx_cra (
    rowid              INT AUTO_INCREMENT PRIMARY KEY,
    fk_user            INT NOT NULL,
    fk_projet          INT NOT NULL,
    date_work          DATE NOT NULL,
    duration           FLOAT DEFAULT 0,
    location_type      ENUM('sur le site', 'télé-travail') DEFAULT 'sur le site',
    
    note_public        TEXT,
    note_private       TEXT,
    
    status             INT DEFAULT 0,
    fk_validator       INT,
    date_validation    DATETIME,
    
    entity             INT DEFAULT 1,
    date_creation      DATETIME NOT NULL,
    tms                TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,

    FOREIGN KEY (fk_user)     REFERENCES llx_user(rowid),
    FOREIGN KEY (fk_projet)   REFERENCES llx_projet(rowid),
    FOREIGN KEY (fk_validator) REFERENCES llx_user(rowid)
) ENGINE=InnoDB;
