CREATE TABLE IF NOT EXISTS user_info (
	id SERIAL PRIMARY KEY,
	username TEXT NOT NULL,
	email TEXT NOT NULL,
	password_hash TEXT
);

CREATE TABLE IF NOT EXISTS user_session (
	user_id INTEGER references user_info(id) ON DELETE CASCADE,
	id TEXT PRIMARY KEY,
	ip_address INET NOT NULL,
	date_created TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
	expiry TIMESTAMP WITH TIME ZONE DEFAULT NOW() + INTERVAL '30 DAYS',
	last_used TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
