DO $$
    BEGIN
        CREATE TYPE link_type as ENUM ('article', 'blog');
    EXCEPTION
        WHEN duplicate_object THEN null;
    END
$$;

CREATE TABLE IF NOT EXISTS articles (
        reference varchar(20) not null,
        title varchar(50) not null,
        previous varchar(20),
        next varchar(20),
        description text,
        content text not null,
        date date not null,
        id serial primary key);

CREATE TABLE IF NOT EXISTS links (
        url varchar(100) not null,
        date_added date not null,
        description text,
        title text not null,
        author varchar(50) not null,
        link_type link_type not null,
        id serial primary key);
