--ABS-6477

---SYSTEMUSER table---
ALTER TABLE SYSTEMUSER ADD (DOMAINUSER VARCHAR2(60) NULL);
     
---LDAPSETTINGS table---
CREATE SEQUENCE SEQ_LDAPSETTINGS
START WITH 1
INCREMENT BY 1;
    
CREATE TABLE LDAPSETTINGS(
  LDAPSETTINGS_ID      NUMBER NOT NULL,
  HOSTNAME             VARCHAR2(60) NOT NULL,
  PORTNUMBER           NUMBER  DEFAULT 389 NOT NULL ,
  DOMAIN               VARCHAR2(60) NOT NULL,
  FQDOMAINNAME         VARCHAR2(60) NOT NULL,
  GROUPSEARCHNAME      VARCHAR2(60)  NULL,
  LOGINTYPE            NUMBER DEFAULT 1 NOT NULL CONSTRAINT LOGINTYPE_VALID1_1
                       CHECK (LOGINTYPE BETWEEN 1 AND 3),
  LDAPTYPE             VARCHAR2(20) NOT NULL
);

COMMENT ON COLUMN LDAPSETTINGS.LOGINTYPE
  IS '1 = AbsLogin(default value)
 2 = Domain login
 3 = Single sign on';

ALTER TABLE LDAPSETTINGS
  ADD CONSTRAINT XPKLDAPSETTINGS PRIMARY KEY (LDAPSETTINGS_ID);
  
CREATE UNIQUE INDEX XAK1LDAPSETTINGS ON LDAPSETTINGS (HOSTNAME ASC, PORTNUMBER ASC, DOMAIN ASC);

