
CREATE DATABASE IF NOT EXISTS mydb;

create table if not exists mydb.users (
id integer primary key AUTO_INCREMENT, 
name varchar(255) not null,
hash varchar(255) not null, 
active bit not null default 0,
host varchar(255) null
);


create table if not exists mydb.activities (
id integer not null,
name varchar(255) not null,
type varchar(255),
dataPath varchar(255),
status varchar(255)
);

create table if not exists mydb.progress (
state varchar(10) not null, 
userId integer not null,
activityId integer not null, 
content varchar(255), 
date long
);


create table if not exists mydb.sessions (
id integer primary key AUTO_INCREMENT,
token varchar(36) not null, 
userIds nvarchar(255) not null, 
active bit not null default 1,
dateTime varchar(255) not null
);

create table if not exists mydb.userStory (
userID integer not null, 
text text not null,
submitTime text not null
);


