CREATE TABLE users (
    id BIGSERIAL PRIMARY KEY,
    created_at TIMESTAMP WITH TIME ZONE NOT NULL,
    updated_at TIMESTAMP WITH TIME ZONE NULL,
    deleted_at TIMESTAMP WITH TIME ZONE NULL,
    uuid VARCHAR(36) NOT NULL UNIQUE,
    username VARCHAR(255) NOT NULL,
    password VARCHAR(255) NOT NULL,
    email VARCHAR(255) UNIQUE,
    verified INT NOT NULL DEFAULT 0
);

CREATE TABLE merch (
    id BIGSERIAL PRIMARY KEY,
    created_at TIMESTAMP WITH TIME ZONE NOT NULL,
    updated_at TIMESTAMP WITH TIME ZONE NULL,
    deleted_at TIMESTAMP WITH TIME ZONE NULL,
    merch_uuid VARCHAR(36) NOT NULL UNIQUE,
    user_uuid VARCHAR(36) NOT NULL UNIQUE,
    name TEXT
);

CREATE TABLE origin_surugaya(
    id BIGSERIAL PRIMARY KEY,
    deleted_at TIMESTAMP WITH TIME ZONE NULL,
    merch_uuid VARCHAR(36) NOT NULL UNIQUE,
    link TEXT,
    cookie_values TEXT
);

CREATE TABLE origin_mandarake(
    id BIGSERIAL PRIMARY KEY,
    deleted_at TIMESTAMP WITH TIME ZONE NULL,
    merch_uuid VARCHAR(36) NOT NULL UNIQUE,
    link TEXT
);


CREATE TABLE sessions (
    id BIGSERIAL PRIMARY KEY,
    created_at TIMESTAMP WITH TIME ZONE NOT NULL,
    updated_at TIMESTAMP WITH TIME ZONE NULL,
    deleted_at TIMESTAMP WITH TIME ZONE NULL,
    user_uuid VARCHAR(36) NOT NULL,
    refresh_uuid VARCHAR(36) NOT NULL UNIQUE,
    session_uuid VARCHAR(36) NOT NULL,
    expires TIMESTAMP WITH TIME ZONE NULL)
