text: ##    DDL for the protfolios microservice
  ##    Added a portfolio composite
  ## Called it accountejb instead of portfolio
  ## to reduce the changes to the code and sql 
  ## statements
  
  DROP TABLE HOLDINGEJB;
  DROP TABLE KEYGENEJB;
  DROP TABLE ORDEREJB;
  DROP TABLE ACCOUNTEJB;
  
  CREATE TABLE HOLDINGEJB
    (PURCHASEPRICE DECIMAL(14, 2),
     HOLDINGID INTEGER NOT NULL,
     QUANTITY DOUBLE NOT NULL,
     PURCHASEDATE TIMESTAMP,
     ACCOUNT_ACCOUNTID INTEGER,
     QUOTE_SYMBOL VARCHAR(250));
  
  ALTER TABLE HOLDINGEJB
    ADD CONSTRAINT PK_HOLDINGEJB PRIMARY KEY (HOLDINGID);
  
  CREATE TABLE KEYGENEJB
    (KEYVAL INTEGER NOT NULL,
     KEYNAME VARCHAR(250) NOT NULL);
  
  ALTER TABLE KEYGENEJB
    ADD CONSTRAINT PK_KEYGENEJB PRIMARY KEY (KEYNAME);
  
  CREATE TABLE ORDEREJB
    (ORDERFEE DECIMAL(14, 2),
     COMPLETIONDATE TIMESTAMP,
     ORDERTYPE VARCHAR(250),
     ORDERSTATUS VARCHAR(250),
     PRICE DECIMAL(14, 2),
     QUANTITY DOUBLE NOT NULL,
     OPENDATE TIMESTAMP,
     ORDERID INTEGER NOT NULL,
     ACCOUNT_ACCOUNTID INTEGER,
     QUOTE_SYMBOL VARCHAR(250),
     HOLDING_HOLDINGID INTEGER);
  
  ALTER TABLE ORDEREJB
    ADD CONSTRAINT PK_ORDEREJB PRIMARY KEY (ORDERID);
  
  CREATE TABLE ACCOUNTEJB
    (ACCOUNTID INTEGER NOT NULL,
     PROFILE_USERID VARCHAR(250) NOT NULL,
     OPENBALANCE DECIMAL(14, 2) NOT NULL,
     BALANCE DECIMAL(14, 2) NOT NULL);
  
  ALTER TABLE ACCOUNTEJB
    ADD CONSTRAINT PK_ACCOUNTEJB PRIMARY KEY (ACCOUNTID);
  
  CREATE INDEX ACCOUNT_USERID ON ACCOUNTEJB(PROFILE_USERID);
  CREATE INDEX HOLDING_ACCOUNTID ON HOLDINGEJB(ACCOUNT_ACCOUNTID);
  CREATE INDEX ORDER_ACCOUNTID ON ORDEREJB(ACCOUNT_ACCOUNTID);
  CREATE INDEX ORDER_HOLDINGID ON ORDEREJB(HOLDING_HOLDINGID);
  CREATE INDEX CLOSED_ORDERS ON ORDEREJB (ACCOUNT_ACCOUNTID,ORDERSTATUS);
  
  