CREATE TABLE status (
 code VARCHAR(255) PRIMARY KEY,
 class VARCHAR(255) NOT NULL,
 description VARCHAR(255) NOT NULL,
 is_active BOOLEAN NOT NULL
);

CREATE TABLE line (
 id INT PRIMARY KEY,
 name VARCHAR(255) NOT NULL UNIQUE
);

CREATE TABLE line_status (
 time DATETIME NOT NULL,
 line_id INT NOT NULL REFERENCES line(id),
 status_code VARCHAR(255) NOT NULL REFERENCES status(code),
 is_active BOOLEAN NOT NULL,
 details TEXT
);
