Created
August 15, 2012 16:14
-
-
Save nkabir/3361312 to your computer and use it in GitHub Desktop.
txdb database schema
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alter table TX_SYMBOL | |
drop constraint TX_SYMBOL_QUOTABLE_ID_FK; | |
alter table TX_SYMBOL | |
drop constraint TX_SYMBOL_SERIES_ID_FK; | |
alter table TX_SYMBOL_SERIES | |
drop constraint TX_SYMBOL_SERIES_AGENT_ID_FK; | |
drop table TX_AGENT cascade; | |
drop table TX_QUOTABLE cascade; | |
drop table TX_SYMBOL cascade; | |
drop table TX_SYMBOL_SERIES cascade; | |
drop sequence TX_AGENT_SEQUENCE; | |
drop sequence TX_QUOTABLE_SEQUENCE; | |
drop sequence TX_SYMBOL_SEQUENCE; | |
drop sequence TX_SYMBOL_SERIES_SEQUENCE; | |
create table TX_AGENT ( | |
ID int4 not null, | |
DESCRIPTION varchar(255) not null, | |
NAME varchar(64) not null unique, | |
primary key (ID) | |
); | |
create table TX_QUOTABLE ( | |
TX_TYPE varchar(31) not null, | |
ID int4 not null, | |
DESCRIPTION varchar(255) not null, | |
NAME varchar(64) not null unique, | |
primary key (ID) | |
); | |
create table TX_SYMBOL ( | |
ID int4 not null, | |
TOKEN varchar(64) not null, | |
QUOTABLE_ID int4 not null, | |
SERIES_ID int4 not null, | |
primary key (ID), | |
unique (QUOTABLE_ID, SERIES_ID), | |
unique (TOKEN, SERIES_ID) | |
); | |
create table TX_SYMBOL_SERIES ( | |
ID int4 not null, | |
DESCRIPTION varchar(255) not null, | |
NAME varchar(64) not null unique, | |
AGENT_ID int4 not null, | |
primary key (ID) | |
); | |
create index TX_AGENT_IDX on TX_AGENT (NAME); | |
create index TX_QUOTABLE_NAME_INDEX on TX_QUOTABLE (NAME); | |
create index TX_SYMBOL_TOKEN_INDEX on TX_SYMBOL (TOKEN); | |
alter table TX_SYMBOL | |
add constraint TX_SYMBOL_QUOTABLE_ID_FK | |
foreign key (QUOTABLE_ID) | |
references TX_QUOTABLE; | |
alter table TX_SYMBOL | |
add constraint TX_SYMBOL_SERIES_ID_FK | |
foreign key (SERIES_ID) | |
references TX_SYMBOL_SERIES; | |
create index TX_SYMBOL_SOURCE_NAME_IDX on TX_SYMBOL_SERIES (NAME); | |
alter table TX_SYMBOL_SERIES | |
add constraint TX_SYMBOL_SERIES_AGENT_ID_FK | |
foreign key (AGENT_ID) | |
references TX_AGENT; | |
create sequence TX_AGENT_SEQUENCE; | |
create sequence TX_QUOTABLE_SEQUENCE; | |
create sequence TX_SYMBOL_SEQUENCE; | |
create sequence TX_SYMBOL_SERIES_SEQUENCE; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment