-- mysql database schema for dasr started 4/18/11

create table rawbed_real (
  rawbed_id int(11) auto_increment primary key,
  bedfile_id int(11) not null,
  filepath varchar(128) not null
) engine=InnoDB default charset=utf8;

create table summarybed_real(
  summarybed_id int(11) auto_increment primary key,
  bedfile_id int(11) not null,
  -- rawbed_id int(11),
  -- experiment_id int(11) not null,
  chrom varchar(8) not null,
  chromstart bigint not null,
  chromend bigint not null,
  name varchar(32),
  score int,
  strand enum('+','-'),
  thickstart bigint,
  thickend bigint,
  itemrgb varchar(16),
  remainder text,
  blockcount bigint,
  blocksizes varchar(32),
  blockstarts varchar(32)
) engine=InnoDB default charset=utf8;

create table agbed_real(
  agbed_id int(11) auto_increment primary key,
  bedfile_id int(11) not null,
  chrom varchar(8) not null,
  chromstart bigint not null,
  chromend bigint not null,
  name varchar(32),
  score int,
  strand enum('+','-'),
  thickstart bigint,
  thickend bigint,
  itemrgb varchar(16),
  remainder text,
  blockcount bigint,
  blocksizes varchar(32),
  blockstarts varchar(32)
) engine=InnoDB default charset=utf8;

create table bedfile_real(
  bedfile_id int(11) auto_increment primary key,
  experiment_id int(11) not null,
  method_id int(11) not null,
  genome_id int(11) not null,
  filetype varchar(32), -- should be rawbed, summarybed, agbed
  name varchar(128) not null,
  upload_date datetime not null,
  expiration datetime,
  header text,
  descr text
) engine=InnoDB default charset=utf8;

create table microbed_real(
  microbed_id int(11) auto_increment primary key,
  bedfile_id int(11) not null,
  chrom varchar(8) not null,
  chromstart bigint not null,
  chromend bigint not null,
  name varchar(32),
  score int,
  strand enum('+','-'),
  thickstart bigint,
  thickend bigint,
  itemrgb varchar(16),
  remainder text,
  blockcount bigint,
  blocksizes varchar(32),
  blockstarts varchar(32)
) engine=InnoDB default charset=utf8;

