
--@BLOCK
-- Levels table (lookup/reference table)
CREATE TABLE levels (
    id      SERIAL PRIMARY KEY, 
    name    VARCHAR(255) NOT NULL 
);

-- Insert the 4 level types
INSERT INTO levels (name) VALUES
    ('debug'),
    ('info'),
    ('warning'),
    ('error');


-- Create table
CREATE TABLE  logs(
    id SERIAL PRIMARY KEY,
    level_id VARCHAR(255) NOT NULL,
    ip VARCHAR(255),
    date timestamp,
    repeating INT,

    FOREIGN KEY (level_id) REFERENCES levels(id)
);
