CREATE TABLE config (
    id int unsigned unique not null auto_increment,
    machine     varchar(30)  not null ,
    slide_type  varchar(30)  not null ,
    pins_x  int  not null ,
    pins_y  int  not null ,
    dist_x  int  null ,
    dist_y  int  null ,
    num_x   int  not null ,
    num_y   int  not null ,
    rep_x   int  null ,
    rep_y   int  null ,
    pattern     varchar(40)  null,
    primary key(id)
);
CREATE TABLE gene (
    id int unsigned unique not null auto_increment ,
    locus   varchar(15)  not null ,
    organism_id int  not null ,
    db  varchar(10)  not null ,
    load_date   datetime  not null ,
    feat_name   varchar(25)  null
);
CREATE TABLE plate (
    id int unsigned unique not null auto_increment ,
    gene_id int null ,
    clone_id int null ,
    plate  int  not null ,
    well   int  not null
);
CREATE TABLE organism (
    id int unsigned unique not null auto_increment ,
    organism    varchar(30)  not null ,
    strain  varchar(15)  null
);
CREATE TABLE pcr (
    id int unsigned unique not null auto_increment ,
    gene_id     int null ,
    plate_id    int  not null ,
    primer_pair_id  int  not null ,
    amplified   tinyint  not null ,
    protocol_id int  not null ,
    rxn_person  varchar(30)  null ,
    rxn_date    datetime  null
);
CREATE TABLE plate_alias (
    id int unsigned unique not null auto_increment ,
    plate  int  null ,
    alias   varchar(50)  null ,
    plate_barcode   varchar(20)  null
);
CREATE TABLE primer (
    id int unsigned unique not null auto_increment ,
    primer_name     varchar(30)  not null ,
    gene_id     int null ,
    storage_id  int  null ,
    design_method   varchar(30)  null ,
    sequence    varchar(75)  not null
);
CREATE TABLE primer_pair (
    id  int unsigned unique not null auto_increment ,
    primer1_id int  not null ,
    primer2_id int  not null ,
    product_size    int  null ,
    gene_id    int  null ,
    Tm tinyint  null ,
    protocol_id int  null
);
CREATE TABLE protocol (
    id  int unsigned unique not null auto_increment,
    name    varchar(30)  not null ,
    type    varchar(30)  null ,
    method  text  null
);
CREATE TABLE slide (
    id  int unsigned unique not null auto_increment,
    slide_name  varchar(30)  not null ,
    slide_type  varchar(30)  not null ,
    config_id   int  not null ,
    slide_lot   varchar(20)  null ,
    bar_code    varchar(10)  null ,
    run_id  int  not null ,
    storage_id  int  null
);
CREATE TABLE slide_plate (
    id int unsigned unique not null auto_increment ,
    slide_type  varchar(30)  not null ,
    plate_num   int  not null ,
    ordinal     int  not null
);
CREATE TABLE slide_run (
    id int unsigned unique not null auto_increment ,
    arrayer     varchar(30)  not null ,
    pattern     varchar(30)  null ,
    array_person    varchar(30)  null ,
    array_date  datetime  not null ,
    comment     varchar(255)  null
);
CREATE TABLE slide_type (
    id int unsigned unique not null auto_increment,
    type    varchar(30)  not null ,
    plate_order     text  not null ,
    config_id   int  not null ,
    comment     varchar(255)  null
);

