-- User Access And Permissions

-- Tables
CREATE TABLE IF NOT EXISTS public.user (
    id INTEGER PRIMARY KEY,
    created_date DATETIME NOT NULL DEFAULT NOW(),
    updated_date DATETIME NOT NULL DEFAULT NOW(),
    last_login DATETIME,
    username VARCHAR(255) NOT NULL,
    email_id INT NOT NULL
);

CREATE TABLE IF NOT EXISTS public.email (
    id TEXT PRIMARY KEY,
    created_date DATETIME NOT NULL DEFAULT NOW(),
    updated_date DATETIME NOT NULL DEFAULT NOW(),
    user_id INT FOREIGN KEY  
);

CREATE TABLE IF NOT EXISTS public.items (
    id INTEGER PRIMARY KEY,
    created_date DATETIME NOT NULL DEFAULT NOW(),
    updated_date DATETIME NOT NULL DEFAULT NOW(),
    user_id INT FOREIGN KEY
    img_url TEXT,
    flavor_text TEXT,
    stats JSON DEFAULT '{}'
);