INITDB = """
create table hosts (
    hostid      INTEGER PRIMARY KEY,
    hostname    char not null unique,
    uuid        char unique,
    lastseen    char
);

create table actions (
    actionid   INTEGER PRIMARY KEY,
    name       char not null,
    args       text
);

create table actionqueue (
    queueid     INTEGER PRIMARY KEY,
    actionid    int not null,
    queue       int not null,
    hostid      int not null,
    setid       int not null
);

create table history (
    historyid   INTEGER PRIMARY KEY,
    actionid    int not null,
    hostid      int not null,
    setid       int not null,
    retcode     int not null,
    data        text,
    timestamp   char
);

create table stateobjects (
    stateid     INTEGER PRIMARY KEY,
    name        char not null,
    args        text
);

create table sets (
    setid       INTEGER PRIMARY KEY,
    hostid      int not null,
    stateid     int not null,
    queue       int not null
);

create table files (
    fileid      INTEGER PRIMARY KEY,
    name        text,
    mode        char(4),
    owner       char,
    grp         char,
    contents    blob
);

create table SESSIONS (
   session_id     INTEGER PRIMARY KEY,
   sid            varchar(32) unique not null,
   createtime     float not null,
   timeout        float not null,
   data           text
);
create index SESSION_IDX on SESSIONS(sid);

"""
       
