create table sessions ( session_entry_id integer not null primary key, session_id text, session_hack timestamp ); -- Note, session_id is what is used to track the session -- and session_entry_id is used for FK mapping between -- tables create table session_ownership ( session_ownership_id integer not null primary key, session_id integer not null references sessions(session_entry_id) on delete cascade, user_id integer not null references users(user_id) on delete cascade ); create table session_vars ( session_var_id integer not null primary key, var_key text not null, var_value text );