"drop table if exists app ;\n\ncreate table app (\n       uniqueId varchar(255) primary key,\n       code text not null,\n       state text not null,\n       name text null default null,\n       description text null default null\n);\n\ndrop table if exists device ;\ndrop table if exists device_journal ;\n\ncreate table device (\n       uniqueId varchar(255) primary key,\n       state text not null\n);\n\ncreate table device_journal (\n       uniqueId varchar(255) primary key,\n       lastModified datetime\n);\n\ndrop index if exists device_lastModified;\n\ncreate index device_lastModified on device_journal(lastModified) ;\n\ndrop table if exists channel ;\n\ncreate table channel (\n       uniqueId varchar(255) primary key,\n       value text default null\n);\n\ndrop table if exists conversation ;\n\ncreate table conversation (\n       uniqueId varchar(255) primary key,\n       conversationId varchar(255),\n       previousId varchar(255),\n       dialogueId varchar(255),\n       context text default null,\n       agent text default null,\n       agentTimestamp text default null,\n       agentTarget text default null,\n       intermediateContext text default null,\n       user text default null,\n       userTimestamp text default null,\n       userTarget text default null,\n       vote text default null,\n       comment text default null\n);\n\ndrop table if exists conversation_state;\n\ncreate table conversation_state (\n       uniqueId varchar(255) primary key,\n       dialogueState text default null,\n       lastMessageId int(11) default null,\n       recording boolean default false\n);\n\ncreate table conversation_history (\n       uniqueId varchar(255) primary key,\n       conversationId varchar(255) not null,\n       messageId int(11) not null,\n       message text not null\n);\ncreate unique index conversation_history_messageId on\n       conversation_history(conversationId, messageId);\n"
