afaisman / Test

0 stars 0 forks source link

issue 7 #7

Open afaisman opened 5 months ago

afaisman commented 5 months ago

-- channelConfig definition

CREATE TABLE channelConfig ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name TEXT(256) NOT NULL, regionId INTEGER NOT NULL, envId INTEGER NOT NULL, clientId INTEGER NOT NULL, createDateTime TEXT, updateDateTime INTEGER, description TEXT(256), overrides TEXT(4096), CONSTRAINT channelConfig_UN UNIQUE (id), CONSTRAINT unique_name UNIQUE (name), CONSTRAINT channelConfig_FK_1 FOREIGN KEY (clientId) REFERENCES clients(id), CONSTRAINT channelConfig_FK FOREIGN KEY (envId) REFERENCES envs(id), CONSTRAINT channelConfig_FK_2 FOREIGN KEY (regionId) REFERENCES regions(id) );

-- clients definition

CREATE TABLE clients (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, clientName VARCHAR(20) NOT NULL, seal INT NOT NULL, lobId INT NOT NULL, description VARCHAR(256), createDateTime DATETIME NOT NULL DEFAULT (datetime(CURRENT_TIMESTAMP)), updateDateTime DATETIME NOT NULL DEFAULT (datetime(CURRENT_TIMESTAMP)),
FOREIGN KEY(lobId) REFERENCES lobs(id), UNIQUE (clientName,seal,lobId) );

-- envs definition

CREATE TABLE envs (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, envName VARCHAR(8) NOT NULL, description VARCHAR(256), createDateTime DATETIME NOT NULL DEFAULT (datetime(CURRENT_TIMESTAMP)), updateDateTime DATETIME NOT NULL DEFAULT (datetime(CURRENT_TIMESTAMP)),
UNIQUE (envName) );

-- identifierTypes definition

CREATE TABLE identifierTypes (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, identifierTypeName VARCHAR(36) NOT NULL, description VARCHAR(256), createDateTime DATETIME NOT NULL DEFAULT (datetime(CURRENT_TIMESTAMP)), updateDateTime DATETIME NOT NULL DEFAULT (datetime(CURRENT_TIMESTAMP)),
UNIQUE (identifierTypeName) );

-- identifiers definition

CREATE TABLE identifiers (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, identifierName VARCHAR(50) NOT NULL, identifierTypeId INT not NULL, envId INT NOT NULL, regionId INT NOT NULL, clientId INT NOT NULL, channelConfigId INT NOT NULL, description VARCHAR(256), createDateTime DATETIME NOT NULL DEFAULT (datetime(CURRENT_TIMESTAMP)), updateDateTime DATETIME NOT NULL DEFAULT (datetime(CURRENT_TIMESTAMP)),
FOREIGN KEY(identifierTypeId) REFERENCES identifierTypes(id), FOREIGN KEY(regionId) REFERENCES regions(id), FOREIGN KEY(clientId) REFERENCES clients(id), FOREIGN KEY(envId) REFERENCES envs(id),
UNIQUE (identifierName) );

-- lobs definition

CREATE TABLE lobs (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, lobName VARCHAR(8) NOT NULL, description VARCHAR(256), createDateTime DATETIME NOT NULL DEFAULT (datetime(CURRENT_TIMESTAMP)), updateDateTime DATETIME NOT NULL DEFAULT (datetime(CURRENT_TIMESTAMP)),
UNIQUE (lobName) );

-- regions definition

CREATE TABLE regions (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, regionName VARCHAR(8) NOT NULL, description VARCHAR(256), createDateTime DATETIME NOT NULL DEFAULT (datetime(CURRENT_TIMESTAMP)), updateDateTime DATETIME NOT NULL DEFAULT (datetime(CURRENT_TIMESTAMP)),
UNIQUE (regionName) );