alter table experiment_run drop constraint FK7A9E7F49E2C93DCD;
alter table protapp_inputs drop constraint FK10307C6EBCA925A7;
alter table protapp_inputs drop constraint FK10307C6EC71681E5;
alter table protapp_outputs drop constraint FK3F6C7DADC71681E5;
alter table protapp_outputs drop constraint FK3F6C7DAD2248C510;
alter table protocol_application drop constraint FK901CE295EBC310C;
alter table protocol_application drop constraint FK901CE29FFE924AD;
drop table experiment cascade;
drop table experiment_run cascade;
drop table input_output_object cascade;
drop table person cascade;
drop table protapp_inputs cascade;
drop table protapp_outputs cascade;
drop table protocol cascade;
drop table protocol_action cascade;
drop table protocol_application cascade;
drop table simple_type_value cascade;
drop sequence hibernate_sequence;
create table experiment (id int8 not null, creation_date timestamp not null, creator varchar(100) not null, modification_date timestamp not null, contact_email varchar(255), contact_fname varchar(255), contact_lname varchar(255), contact_notes varchar(255), date_performed date not null, description varchar(2000), hypothesis varchar(500), name varchar(200) not null, notes varchar(2000), url varchar(200), primary key (id));
create table experiment_run (id int8 not null, creation_date timestamp not null, creator varchar(100) not null, modification_date timestamp not null, comments varchar(2000), date_performed date not null, name varchar(50) not null, experiment_id int8 not null, primary key (id));
create table input_output_object (id int8 not null, additional_info varchar(2000), data_file_url varchar(200), name varchar(200) not null, primary key (id));
create table protapp_inputs (protapp_id int8 not null, input_id int8 not null);
create table protapp_outputs (protapp_id int8 not null, output_id int8 not null);
create table protocol (id int8 not null, creation_date timestamp not null, creator varchar(100) not null, modification_date timestamp not null, contact_email varchar(255), contact_fname varchar(255), contact_lname varchar(255), contact_notes varchar(255), description varchar(2000), instrument varchar(200), name varchar(200) not null, notes varchar(2000), software varchar(200), primary key (id));
create table protocol_application (id int8 not null, activity_date date not null, additional_info varchar(2000), creation_date timestamp not null, creator varchar(100) not null, modification_date timestamp not null, comments varchar(2000), name varchar(200) not null, step_number int8 not null, experiment_run_id int8 not null, protocol_id int8 not null, primary key (id));
create index experiment_name_idx on experiment (name);
create index experiment_description_idx on experiment (description);
alter table experiment_run add constraint FK7A9E7F49E2C93DCD foreign key (experiment_id) references experiment;
alter table protapp_inputs add constraint FK10307C6EBCA925A7 foreign key (input_id) references input_output_object;
alter table protapp_inputs add constraint FK10307C6EC71681E5 foreign key (protapp_id) references protocol_application;
alter table protapp_outputs add constraint FK3F6C7DADC71681E5 foreign key (protapp_id) references protocol_application;
alter table protapp_outputs add constraint FK3F6C7DAD2248C510 foreign key (output_id) references input_output_object;
create index protocol_desc_idx on protocol (description);
create index protocol_name_idx on protocol (name);
alter table protocol_application add constraint FK901CE295EBC310C foreign key (experiment_run_id) references experiment_run;
alter table protocol_application add constraint FK901CE29FFE924AD foreign key (protocol_id) references protocol;
create sequence hibernate_sequence;
