
----------------------------------------------------------------
--
-- Table creation scripts for class source
--

----------------------------------------------------------------
--
-- Schema
--
alter session set current_schema=rsat;


----------------------------------------------------------------
--
-- Main table - source
--
CREATE TABLE source
	(
		id                               	VARCHAR(32)	NOT NULL PRIMARY KEY,
		chrom_position                   	VARCHAR(255),
		chromosome                       	VARCHAR(255),
		contig                           	VARCHAR(255),
		isolate                          	VARCHAR(255),
		organism                         	VARCHAR(255),
		plasmid                          	VARCHAR(255),
		serotype                         	VARCHAR(255),
		strain                           	VARCHAR(255),
		sub_strain                       	VARCHAR(255),
		taxid                            	VARCHAR(255),
		type                             	VARCHAR(255)
	)
;
GRANT select ON source TO amaze;

----------------------------------------------------------------
--
-- Multivalue field - source_db_xref
--
CREATE TABLE source_db_xref
	(
		id                               	VARCHAR(32)	NOT NULL,
		db_xref                          	VARCHAR(255)
	)
;
CREATE INDEX source_db_xref_id_index ON source_db_xref (id);
GRANT select ON source_db_xref TO amaze;

----------------------------------------------------------------
--
-- Multivalue field - source_host
--
CREATE TABLE source_host
	(
		id                               	VARCHAR(32)	NOT NULL,
		host                             	VARCHAR(255)
	)
;
CREATE INDEX source_host_id_index ON source_host (id);
GRANT select ON source_host TO amaze;

----------------------------------------------------------------
--
-- Multivalue field - source_isolation_source
--
CREATE TABLE source_isolation_source
	(
		id                               	VARCHAR(32)	NOT NULL,
		isolation_source                 	VARCHAR(255)
	)
;
CREATE INDEX source_isolation_source_id_index ON source_isolation_source (id);
GRANT select ON source_isolation_source TO amaze;

----------------------------------------------------------------
--
-- Multivalue field - source_mol_type
--
CREATE TABLE source_mol_type
	(
		id                               	VARCHAR(32)	NOT NULL,
		mol_type                         	VARCHAR(255)
	)
;
CREATE INDEX source_mol_type_id_index ON source_mol_type (id);
GRANT select ON source_mol_type TO amaze;

----------------------------------------------------------------
--
-- Multivalue field - source_note
--
CREATE TABLE source_note
	(
		id                               	VARCHAR(32)	NOT NULL,
		note                             	VARCHAR(255)
	)
;
CREATE INDEX source_note_id_index ON source_note (id);
GRANT select ON source_note TO amaze;

----------------------------------------------------------------
--
-- Multivalue field - source_sub_species
--
CREATE TABLE source_sub_species
	(
		id                               	VARCHAR(32)	NOT NULL,
		sub_species                      	VARCHAR(255)
	)
;
CREATE INDEX source_sub_species_id_index ON source_sub_species (id);
GRANT select ON source_sub_species TO amaze;

----------------------------------------------------------------
--
-- Multivalue field - source_transl_except
--
CREATE TABLE source_transl_except
	(
		id                               	VARCHAR(32)	NOT NULL,
		transl_except                    	VARCHAR(255)
	)
;
CREATE INDEX source_transl_except_id_index ON source_transl_except (id);
GRANT select ON source_transl_except TO amaze;

----------------------------------------------------------------
--
-- Quit
--
quit;