CREATE TABLE stock (
    stockId serial PRIMARY KEY,
    ticker varchar(10)
);

CREATE TABLE history (
    date date DEFAULT CURRENT_DATE NOT NULL,
    stockId integer NOT NULL REFERENCES stock ON DELETE CASCADE ON UPDATE CASCADE,
    open double precision DEFAULT NULL,
    high double precision DEFAULT NULL,
    low double precision DEFAULT NULL,
    close double precision DEFAULT NULL,
    adjClose double precision DEFAULT NULL,
    volume integer DEFAULT NULL,
    div real DEFAULT NULL,
    adjDiv real DEFAULT NULL,
    split real DEFAULT NULL,
    PRIMARY KEY (date, stockid)
);
