CREATE TABLE account (
    id uuid DEFAULT gen_random_uuid(),
    hash varchar(64) NOT NULL, 
    salt varchar(16) NOT NULL,
    created_at timestamp default NULL,
    updated_at timestamp default NULL,
    deleted_at timestamp default NULL,
    PRIMARY KEY(id)
);

CREATE TABLE account_info_type (
    id BIGSERIAL,
    name varchar(255) NOT NULL,
    enabled boolean default false,
    created_at timestamp default NULL,
    updated_at timestamp default NULL,
    deleted_at timestamp default NULL,
    PRIMARY KEY(id)
);

CREATE TABLE account_info (
    id uuid DEFAULT gen_random_uuid(),
    account_id uuid NOT NULL,
    account_info_type_id bigint NOT NULL,
    value varchar(255) NOT NULL,
    created_at timestamp default NULL,
    updated_at timestamp default NULL,
    deleted_at timestamp default NULL,
    CONSTRAINT fk_account_info_2_account 
        FOREIGN KEY(account_id) 
            REFERENCES account(id) 
            ON DELETE CASCADE,
    CONSTRAINT fk_account_info_type_2_account 
        FOREIGN KEY(account_info_type_id) 
            REFERENCES account_info_type(id) 
            ON DELETE CASCADE,
    PRIMARY KEY(id)
);