alter table tl_lawiki10_attachment drop foreign key FK_NEW_1983840333_389AD9A2FE939F2A;
alter table tl_lawiki10_attachment drop foreign key FK_NEW_1983840333_389AD9A2131CE31E;
alter table tl_lawiki10_wiki drop foreign key FK_NEW_1983840333_87917942E42F4351;
alter table tl_lawiki10_wiki_user drop foreign key FK_NEW_1983840333_7B83A4A85F0116B6;
alter table tl_lawiki10_message drop foreign key FK_NEW_1983840333_4A6067E89357B45B;
alter table tl_lawiki10_message drop foreign key FK_NEW_1983840333_4A6067E897F0DB46;
alter table tl_lawiki10_message drop foreign key FK_NEW_1983840333_4A6067E8E42F4351;
alter table tl_lawiki10_message drop foreign key FK_NEW_1983840333_4A6067E8131CE31E;
alter table tl_lawiki10_message drop foreign key FK_NEW_1983840333_4A6067E8647A7264;
alter table tl_lawiki10_message drop foreign key FK_NEW_1983840333_4A6067E824089E4D;
alter table tl_lawiki10_message_seq drop foreign key FK_NEW_1983840333_D2C71F88FE939F2A;
alter table tl_lawiki10_message_seq drop foreign key FK_NEW_1983840333_D2C71F8845213B4D;
alter table tl_lawiki10_tool_session drop foreign key FK_NEW_1983840333_5A04D7AE131CE31E;
drop table if exists tl_lawiki10_attachment;
drop table if exists tl_lawiki10_wiki;
drop table if exists tl_lawiki10_wiki_user;
drop table if exists tl_lawiki10_message;
drop table if exists tl_lawiki10_message_seq;
drop table if exists tl_lawiki10_report;
drop table if exists tl_lawiki10_tool_session;
create table tl_lawiki10_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, wiki_uid bigint, message_uid bigint, primary key (uid));
create table tl_lawiki10_wiki (uid bigint not null auto_increment, create_date datetime, update_date datetime, create_by bigint, title varchar(255), allow_anonym bit, run_offline bit, lock_on_finished bit, instructions text, online_instructions text, offline_instructions text, content_in_use bit, define_later bit, content_id bigint unique, allow_edit bit, allow_rich_editor bit, limited_of_chars integer, limited_input_flag bit, allow_new_topic bit, allow_upload bit, maximum_reply integer, minimum_reply integer, reflect_instructions varchar(255), reflect_on_activity bit, primary key (uid));
create table tl_lawiki10_wiki_user (uid bigint not null auto_increment, user_id bigint, last_name varchar(255), first_name varchar(255), session_id bigint, login_name varchar(255), session_finished bit, primary key (uid));
create table tl_lawiki10_message (uid bigint not null auto_increment, create_date datetime, last_reply_date datetime, update_date datetime, create_by bigint, modified_by bigint, subject varchar(255), body text, is_authored bit, is_anonymous bit, wiki_session_uid bigint, parent_uid bigint, wiki_uid bigint, reply_number integer, hide_flag bit, report_id bigint, primary key (uid));
create table tl_lawiki10_message_seq (uid bigint not null auto_increment, root_message_uid bigint, message_uid bigint, message_level smallint, primary key (uid));
create table tl_lawiki10_report (uid bigint not null auto_increment, comment text, release_date datetime, mark float, primary key (uid));
create table tl_lawiki10_tool_session (uid bigint not null auto_increment, version integer not null, session_end_date datetime, session_start_date datetime, status integer, wiki_uid bigint, session_id bigint, session_name varchar(250), mark_released bit, primary key (uid));
alter table tl_lawiki10_attachment add index FK_NEW_1983840333_389AD9A2FE939F2A (message_uid), add constraint FK_NEW_1983840333_389AD9A2FE939F2A foreign key (message_uid) references tl_lawiki10_message (uid);
alter table tl_lawiki10_attachment add index FK_NEW_1983840333_389AD9A2131CE31E (wiki_uid), add constraint FK_NEW_1983840333_389AD9A2131CE31E foreign key (wiki_uid) references tl_lawiki10_wiki (uid);
alter table tl_lawiki10_wiki add index FK_NEW_1983840333_87917942E42F4351 (create_by), add constraint FK_NEW_1983840333_87917942E42F4351 foreign key (create_by) references tl_lawiki10_wiki_user (uid);
alter table tl_lawiki10_wiki_user add index FK_NEW_1983840333_7B83A4A85F0116B6 (session_id), add constraint FK_NEW_1983840333_7B83A4A85F0116B6 foreign key (session_id) references tl_lawiki10_tool_session (uid);
alter table tl_lawiki10_message add index FK_NEW_1983840333_4A6067E89357B45B (wiki_session_uid), add constraint FK_NEW_1983840333_4A6067E89357B45B foreign key (wiki_session_uid) references tl_lawiki10_tool_session (uid);
alter table tl_lawiki10_message add index FK_NEW_1983840333_4A6067E897F0DB46 (report_id), add constraint FK_NEW_1983840333_4A6067E897F0DB46 foreign key (report_id) references tl_lawiki10_report (uid);
alter table tl_lawiki10_message add index FK_NEW_1983840333_4A6067E8E42F4351 (create_by), add constraint FK_NEW_1983840333_4A6067E8E42F4351 foreign key (create_by) references tl_lawiki10_wiki_user (uid);
alter table tl_lawiki10_message add index FK_NEW_1983840333_4A6067E8131CE31E (wiki_uid), add constraint FK_NEW_1983840333_4A6067E8131CE31E foreign key (wiki_uid) references tl_lawiki10_wiki (uid);
alter table tl_lawiki10_message add index FK_NEW_1983840333_4A6067E8647A7264 (modified_by), add constraint FK_NEW_1983840333_4A6067E8647A7264 foreign key (modified_by) references tl_lawiki10_wiki_user (uid);
alter table tl_lawiki10_message add index FK_NEW_1983840333_4A6067E824089E4D (parent_uid), add constraint FK_NEW_1983840333_4A6067E824089E4D foreign key (parent_uid) references tl_lawiki10_message (uid);
alter table tl_lawiki10_message_seq add index FK_NEW_1983840333_D2C71F88FE939F2A (message_uid), add constraint FK_NEW_1983840333_D2C71F88FE939F2A foreign key (message_uid) references tl_lawiki10_message (uid);
alter table tl_lawiki10_message_seq add index FK_NEW_1983840333_D2C71F8845213B4D (root_message_uid), add constraint FK_NEW_1983840333_D2C71F8845213B4D foreign key (root_message_uid) references tl_lawiki10_message (uid);
alter table tl_lawiki10_tool_session add index FK_NEW_1983840333_5A04D7AE131CE31E (wiki_uid), add constraint FK_NEW_1983840333_5A04D7AE131CE31E foreign key (wiki_uid) references tl_lawiki10_wiki (uid);
