alter table lams_text_search_condition drop foreign key FK69B884B21E70F543;
alter table tl_laqa11_condition_questions drop foreign key FK987C536D421F345;
alter table tl_laqa11_condition_questions drop foreign key FK987C536BAFF08E4;
alter table tl_laqa11_conditions drop foreign key FK93A2C20B9F17B22E;
alter table tl_laqa11_conditions drop foreign key FK93A2C20B3E8DC190;
alter table tl_laqa11_que_content drop foreign key FK3B7D2008390D0AD4;
alter table tl_laqa11_que_usr drop foreign key FK5EF1D0A3C9EF79B4;
alter table tl_laqa11_response_rating drop foreign key FK607F0FE84CBD597;
alter table tl_laqa11_response_rating drop foreign key FK607F0FE8E3904F88;
alter table tl_laqa11_session drop foreign key FKAE3EF023390D0AD4;
alter table tl_laqa11_uploadedfile drop foreign key FK36DB666F390D0AD4;
alter table tl_laqa11_usr_resp drop foreign key FKCB2DEFAE10BA166C;
alter table tl_laqa11_usr_resp drop foreign key FKCB2DEFAE3F6A055B;
alter table tl_laqa11_wizard_cognitive_skill drop foreign key FK3BA4132BCBB0DC8D;
alter table tl_laqa11_wizard_question drop foreign key FKAF08A0C7EFF77FD4;
drop table if exists lams_branch_condition;
drop table if exists lams_text_search_condition;
drop table if exists tl_laqa11_condition_questions;
drop table if exists tl_laqa11_conditions;
drop table if exists tl_laqa11_configuration;
drop table if exists tl_laqa11_content;
drop table if exists tl_laqa11_que_content;
drop table if exists tl_laqa11_que_usr;
drop table if exists tl_laqa11_response_rating;
drop table if exists tl_laqa11_session;
drop table if exists tl_laqa11_uploadedfile;
drop table if exists tl_laqa11_usr_resp;
drop table if exists tl_laqa11_wizard_category;
drop table if exists tl_laqa11_wizard_cognitive_skill;
drop table if exists tl_laqa11_wizard_question;
create table lams_branch_condition (condition_id bigint not null auto_increment, condition_ui_id integer, order_id integer, name varchar(255), display_name varchar(255), type varchar(255), start_value varchar(255), end_value varchar(255), exact_match_value varchar(255), primary key (condition_id));
create table lams_text_search_condition (condition_id bigint not null, text_search_all_words varchar(255), text_search_phrase varchar(255), text_search_any_words varchar(255), text_search_excluded_words varchar(255), primary key (condition_id));
create table tl_laqa11_condition_questions (condition_id bigint not null, question_uid bigint not null, primary key (condition_id, question_uid));
create table tl_laqa11_conditions (condition_id bigint not null, content_uid bigint, primary key (condition_id));
create table tl_laqa11_configuration (uid bigint not null auto_increment, config_key varchar(30) unique, config_value varchar(255), primary key (uid));
create table tl_laqa11_content (uid bigint not null auto_increment, qa_content_id bigint not null, title longtext, instructions longtext, reflectionSubject longtext, define_later bit, run_offline bit, creation_date datetime, update_date datetime, submission_deadline datetime, questions_sequenced bit, reflect bit, username_visible bit, allow_rate_answers bit, created_by bigint, synch_in_monitor bit, lockWhenFinished bit, allow_rich_editor bit, content_inUse bit, showOtherAnswers bit, offline_instructions longtext, online_instructions longtext, primary key (uid));
create table tl_laqa11_que_content (uid bigint not null auto_increment, question longtext, display_order integer, feedback longtext, answer_required bit, qa_content_id bigint, primary key (uid));
create table tl_laqa11_que_usr (uid bigint not null auto_increment, que_usr_id bigint not null, username varchar(255), fullname varchar(255), responseFinalized bit, learnerFinished bit, qa_session_id bigint, primary key (uid));
create table tl_laqa11_response_rating (uid bigint not null auto_increment, user_id bigint, rating float, response_id bigint, primary key (uid));
create table tl_laqa11_session (uid bigint not null auto_increment, qa_session_id bigint not null, session_start_date datetime, session_end_date datetime, session_status varchar(100), session_name varchar(100), qa_content_id bigint, primary key (uid));
create table tl_laqa11_uploadedfile (submissionId bigint not null auto_increment, uuid varchar(255), isOnline_File bit, filename varchar(255), qa_content_id bigint, primary key (submissionId));
create table tl_laqa11_usr_resp (response_id bigint not null auto_increment, answer longtext, attempt_time datetime, visible bit, time_zone varchar(255), qa_que_content_id bigint, que_usr_id bigint, primary key (response_id));
create table tl_laqa11_wizard_category (uid bigint not null auto_increment, title varchar(255) not null, primary key (uid));
create table tl_laqa11_wizard_cognitive_skill (uid bigint not null auto_increment, title varchar(255) not null, category_uid bigint, primary key (uid));
create table tl_laqa11_wizard_question (uid bigint not null auto_increment, cognitive_skill_uid bigint, title longtext not null, primary key (uid));
alter table lams_text_search_condition add index FK69B884B21E70F543 (condition_id), add constraint FK69B884B21E70F543 foreign key (condition_id) references lams_branch_condition (condition_id);
alter table tl_laqa11_condition_questions add index FK987C536D421F345 (condition_id), add constraint FK987C536D421F345 foreign key (condition_id) references tl_laqa11_conditions (condition_id);
alter table tl_laqa11_condition_questions add index FK987C536BAFF08E4 (question_uid), add constraint FK987C536BAFF08E4 foreign key (question_uid) references tl_laqa11_que_content (uid);
alter table tl_laqa11_conditions add index FK93A2C20B9F17B22E (content_uid), add constraint FK93A2C20B9F17B22E foreign key (content_uid) references tl_laqa11_content (uid);
alter table tl_laqa11_conditions add index FK93A2C20B3E8DC190 (condition_id), add constraint FK93A2C20B3E8DC190 foreign key (condition_id) references lams_text_search_condition (condition_id);
alter table tl_laqa11_que_content add index FK3B7D2008390D0AD4 (qa_content_id), add constraint FK3B7D2008390D0AD4 foreign key (qa_content_id) references tl_laqa11_content (uid);
alter table tl_laqa11_que_usr add index FK5EF1D0A3C9EF79B4 (qa_session_id), add constraint FK5EF1D0A3C9EF79B4 foreign key (qa_session_id) references tl_laqa11_session (uid);
alter table tl_laqa11_response_rating add index FK607F0FE84CBD597 (user_id), add constraint FK607F0FE84CBD597 foreign key (user_id) references tl_laqa11_que_usr (uid);
alter table tl_laqa11_response_rating add index FK607F0FE8E3904F88 (response_id), add constraint FK607F0FE8E3904F88 foreign key (response_id) references tl_laqa11_usr_resp (response_id);
alter table tl_laqa11_session add index FKAE3EF023390D0AD4 (qa_content_id), add constraint FKAE3EF023390D0AD4 foreign key (qa_content_id) references tl_laqa11_content (uid);
alter table tl_laqa11_uploadedfile add index FK36DB666F390D0AD4 (qa_content_id), add constraint FK36DB666F390D0AD4 foreign key (qa_content_id) references tl_laqa11_content (uid);
alter table tl_laqa11_usr_resp add index FKCB2DEFAE10BA166C (que_usr_id), add constraint FKCB2DEFAE10BA166C foreign key (que_usr_id) references tl_laqa11_que_usr (uid);
alter table tl_laqa11_usr_resp add index FKCB2DEFAE3F6A055B (qa_que_content_id), add constraint FKCB2DEFAE3F6A055B foreign key (qa_que_content_id) references tl_laqa11_que_content (uid);
alter table tl_laqa11_wizard_cognitive_skill add index FK3BA4132BCBB0DC8D (category_uid), add constraint FK3BA4132BCBB0DC8D foreign key (category_uid) references tl_laqa11_wizard_category (uid);
alter table tl_laqa11_wizard_question add index FKAF08A0C7EFF77FD4 (cognitive_skill_uid), add constraint FKAF08A0C7EFF77FD4 foreign key (cognitive_skill_uid) references tl_laqa11_wizard_cognitive_skill (uid);
