alter table lams_text_search_condition drop foreign key FK69B884B21E70F543;
alter table tl_lachat11_attachment drop foreign key FK9ED6CB2E1A3926E3;
alter table tl_lachat11_conditions drop foreign key FKDC63A8C3AD5A4F84;
alter table tl_lachat11_conditions drop foreign key FKDC63A8C33E8DC190;
alter table tl_lachat11_message drop foreign key FKCC08C1DCCF3BF9B6;
alter table tl_lachat11_message drop foreign key FKCC08C1DC2AF61E05;
alter table tl_lachat11_message drop foreign key FKCC08C1DC9C8469FC;
alter table tl_lachat11_session drop foreign key FK96E446B1A3926E3;
alter table tl_lachat11_user drop foreign key FK4EB82169C8469FC;
drop table if exists lams_branch_condition;
drop table if exists lams_text_search_condition;
drop table if exists tl_lachat11_attachment;
drop table if exists tl_lachat11_chat;
drop table if exists tl_lachat11_conditions;
drop table if exists tl_lachat11_message;
drop table if exists tl_lachat11_session;
drop table if exists tl_lachat11_user;
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_lachat11_attachment (uid bigint not null auto_increment, file_version_id bigint, file_type varchar(255), file_name varchar(255), file_uuid bigint, create_date datetime, chat_uid bigint, primary key (uid));
create table tl_lachat11_chat (uid bigint not null auto_increment, create_date datetime, update_date datetime, create_by bigint, title varchar(255), instructions longtext, run_offline bit, lock_on_finished bit, reflect_on_activity bit, reflect_instructions longtext, online_instructions longtext, offline_instructions longtext, content_in_use bit, define_later bit, tool_content_id bigint, filtering_enabled bit, filter_keywords longtext, submission_deadline datetime, primary key (uid));
create table tl_lachat11_conditions (condition_id bigint not null, content_uid bigint, primary key (condition_id));
create table tl_lachat11_message (uid bigint not null auto_increment, chat_session_uid bigint not null, from_user_uid bigint, to_user_uid bigint, type varchar(255), body longtext, send_date datetime, hidden bit, primary key (uid));
create table tl_lachat11_session (uid bigint not null auto_increment, session_end_date datetime, session_start_date datetime, status integer, session_id bigint, session_name varchar(250), chat_uid bigint, jabber_room varchar(250), room_created bit, primary key (uid));
create table tl_lachat11_user (uid bigint not null auto_increment, user_id bigint, last_name varchar(255), login_name varchar(255), first_name varchar(255), jabber_id varchar(255), finishedActivity bit, jabber_nickname varchar(255), chat_session_uid bigint, 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_lachat11_attachment add index FK9ED6CB2E1A3926E3 (chat_uid), add constraint FK9ED6CB2E1A3926E3 foreign key (chat_uid) references tl_lachat11_chat (uid);
alter table tl_lachat11_conditions add index FKDC63A8C3AD5A4F84 (content_uid), add constraint FKDC63A8C3AD5A4F84 foreign key (content_uid) references tl_lachat11_chat (uid);
alter table tl_lachat11_conditions add index FKDC63A8C33E8DC190 (condition_id), add constraint FKDC63A8C33E8DC190 foreign key (condition_id) references lams_text_search_condition (condition_id);
alter table tl_lachat11_message add index FKCC08C1DCCF3BF9B6 (from_user_uid), add constraint FKCC08C1DCCF3BF9B6 foreign key (from_user_uid) references tl_lachat11_user (uid);
alter table tl_lachat11_message add index FKCC08C1DC2AF61E05 (to_user_uid), add constraint FKCC08C1DC2AF61E05 foreign key (to_user_uid) references tl_lachat11_user (uid);
alter table tl_lachat11_message add index FKCC08C1DC9C8469FC (chat_session_uid), add constraint FKCC08C1DC9C8469FC foreign key (chat_session_uid) references tl_lachat11_session (uid);
alter table tl_lachat11_session add index FK96E446B1A3926E3 (chat_uid), add constraint FK96E446B1A3926E3 foreign key (chat_uid) references tl_lachat11_chat (uid);
alter table tl_lachat11_user add index FK4EB82169C8469FC (chat_session_uid), add constraint FK4EB82169C8469FC foreign key (chat_session_uid) references tl_lachat11_session (uid);
