Changement de nom de table SQL + ajout des colonnes OSName/OSVersion/Compatibilities pour les AS

This commit is contained in:
Emmanuel Garette 2020-09-05 16:36:59 +02:00
parent 54c895f822
commit 7becbca64e
1 changed files with 29 additions and 45 deletions

View File

@ -1,5 +1,4 @@
-- Deployment CREATE TABLE ProviderDeployment (
CREATE TABLE Deployment (
DeploymentId SERIAL PRIMARY KEY, DeploymentId SERIAL PRIMARY KEY,
ProviderType VARCHAR(255) NOT NULL, ProviderType VARCHAR(255) NOT NULL,
TargetType VARCHAR(255) NOT NULL, TargetType VARCHAR(255) NOT NULL,
@ -12,10 +11,9 @@ CREATE TABLE Deployment (
Labels VARCHAR(255) [] DEFAULT '{}', Labels VARCHAR(255) [] DEFAULT '{}',
UNIQUE (TargetType, TargetName) UNIQUE (TargetType, TargetName)
); );
CREATE INDEX Deployment_FactoryNodeName_index ON Deployment(FactoryNodeName); CREATE INDEX Deployment_FactoryNodeName_index ON ProviderDeployment(FactoryNodeName);
-- Cluster CREATE TABLE ProviderFactoryCluster (
CREATE TABLE FactoryCluster (
ClusterId SERIAL PRIMARY KEY, ClusterId SERIAL PRIMARY KEY,
ClusterName VARCHAR(255) NOT NULL UNIQUE, ClusterName VARCHAR(255) NOT NULL UNIQUE,
ClusterDescription VARCHAR(255) NOT NULL, ClusterDescription VARCHAR(255) NOT NULL,
@ -23,34 +21,27 @@ CREATE TABLE FactoryCluster (
ZoneName VARCHAR(255) NOT NULL ZoneName VARCHAR(255) NOT NULL
); );
-- Node in Cluster CREATE TABLE ProviderFactoryClusterNode (
CREATE TABLE FactoryClusterNode (
ClusterNodeId SERIAL PRIMARY KEY, ClusterNodeId SERIAL PRIMARY KEY,
ClusterId INTEGER NOT NULL, ClusterId INTEGER NOT NULL,
ServerName VARCHAR(255) NOT NULL UNIQUE, ServerName VARCHAR(255) NOT NULL UNIQUE,
FOREIGN KEY (ClusterId) REFERENCES FactoryCluster(ClusterId) FOREIGN KEY (ClusterId) REFERENCES ProviderFactoryCluster(ClusterId)
); );
CREATE INDEX FactoryClusterNode_ServerName_index ON FactoryClusterNode(ServerName); CREATE INDEX ProviderFactoryClusterNode_ServerName_index ON ProviderFactoryClusterNode(ServerName);
-- Site
CREATE TABLE Site ( CREATE TABLE InfraSite (
SiteId SERIAL PRIMARY KEY, SiteId SERIAL PRIMARY KEY,
SiteName VARCHAR(255) NOT NULL UNIQUE, SiteName VARCHAR(255) NOT NULL UNIQUE,
SiteDescription VARCHAR(255) NOT NULL SiteDescription VARCHAR(255) NOT NULL
); );
-- Zone CREATE TABLE InfraZone (
CREATE TABLE Zone (
ZoneId SERIAL PRIMARY KEY, ZoneId SERIAL PRIMARY KEY,
ZoneName VARCHAR(255) NOT NULL UNIQUE, ZoneName VARCHAR(255) NOT NULL UNIQUE,
ZoneDescription VARCHAR(255) NOT NULL, ZoneDescription VARCHAR(255) NOT NULL,
SitesName VARCHAR(255) [] NOT NULL SitesName VARCHAR(255) [] NOT NULL
); );
-------------------------------------
-- Infra
-------------------------------------
-- Server
CREATE TABLE InfraServer( CREATE TABLE InfraServer(
ServerId SERIAL PRIMARY KEY, ServerId SERIAL PRIMARY KEY,
ServerName VARCHAR(255) NOT NULL UNIQUE, ServerName VARCHAR(255) NOT NULL UNIQUE,
@ -61,15 +52,14 @@ CREATE TABLE InfraServer(
ZonesName VARCHAR(255) [] NOT NULL, ZonesName VARCHAR(255) [] NOT NULL,
ZonesIP VARCHAR(255) [] NOT NULL ZonesIP VARCHAR(255) [] NOT NULL
); );
-- Source
CREATE TABLE Source ( CREATE TABLE SettingSource (
SourceId SERIAL PRIMARY KEY, SourceId SERIAL PRIMARY KEY,
SourceName VARCHAR(255) NOT NULL UNIQUE, SourceName VARCHAR(255) NOT NULL UNIQUE,
SourceDirectory TEXT SourceDirectory TEXT
); );
-- Release CREATE TABLE SettingRelease (
CREATE TABLE Release (
ReleaseId SERIAL PRIMARY KEY, ReleaseId SERIAL PRIMARY KEY,
ReleaseName VARCHAR(255) NOT NULL, ReleaseName VARCHAR(255) NOT NULL,
ReleaseSourceName VARCHAR(255) NOT NULL, ReleaseSourceName VARCHAR(255) NOT NULL,
@ -78,11 +68,6 @@ CREATE TABLE Release (
UNIQUE (ReleaseDistribution, ReleaseSourceName) UNIQUE (ReleaseDistribution, ReleaseSourceName)
); );
-------------------------------------
-- Setting
-------------------------------------
-- SettingServer
CREATE TABLE SettingServer( CREATE TABLE SettingServer(
ServerId SERIAL PRIMARY KEY, ServerId SERIAL PRIMARY KEY,
ServerName VARCHAR(255) NOT NULL UNIQUE, ServerName VARCHAR(255) NOT NULL UNIQUE,
@ -90,42 +75,41 @@ CREATE TABLE SettingServer(
ReleaseName VARCHAR(255) NOT NULL ReleaseName VARCHAR(255) NOT NULL
); );
-- Servermodel CREATE TABLE SettingServermodel (
CREATE TABLE Servermodel (
ServermodelId SERIAL PRIMARY KEY, ServermodelId SERIAL PRIMARY KEY,
ServermodelName VARCHAR(255) NOT NULL, ServermodelName VARCHAR(255) NOT NULL,
ServermodelDescription VARCHAR(255) NOT NULL, ServermodelDescription VARCHAR(255) NOT NULL,
Osname VARCHAR(255),
Osversion VARCHAR(255),
ServermodelParents VARCHAR(255) [] DEFAULT '{}', ServermodelParents VARCHAR(255) [] DEFAULT '{}',
ReleaseDistribution VARCHAR(255) NOT NULL, ReleaseDistribution VARCHAR(255) NOT NULL,
ReleaseName VARCHAR(255) NOT NULL, ReleaseName VARCHAR(255) NOT NULL,
ServermodelApplicationserviceId INTEGER NOT NULL, ServermodelApplicationserviceId INTEGER NOT NULL,
OSName VARCHAR(255),
OSVersion VARCHAR(255),
UNIQUE (ServermodelName, ReleaseDistribution) UNIQUE (ServermodelName, ReleaseDistribution)
); );
CREATE INDEX ServermodelApplicationserviceId_index ON Servermodel (ServermodelApplicationserviceId); CREATE INDEX ServermodelApplicationserviceId_index ON SettingServermodel (ServermodelApplicationserviceId);
-- Applicationservice CREATE TABLE SettingApplicationservice (
CREATE TABLE Applicationservice (
ApplicationserviceId SERIAL PRIMARY KEY, ApplicationserviceId SERIAL PRIMARY KEY,
ApplicationserviceName VARCHAR(255) NOT NULL, ApplicationserviceName VARCHAR(255) NOT NULL,
ApplicationserviceDescription VARCHAR(255) NOT NULL, ApplicationserviceDescription VARCHAR(255) NOT NULL,
ReleaseDistribution VARCHAR(255) NOT NULL, ReleaseDistribution VARCHAR(255) NOT NULL,
ReleaseName VARCHAR(255) NOT NULL, ReleaseName VARCHAR(255) NOT NULL,
SourceName VARCHAR(255) NOT NULL, SourceName VARCHAR(255) NOT NULL,
OS JSON, Compatibilities JSON,
OSName VARCHAR(255),
OSVersion VARCHAR(255),
UNIQUE (ApplicationserviceName, ReleaseDistribution) UNIQUE (ApplicationserviceName, ReleaseDistribution)
); );
CREATE TABLE ApplicationserviceDependency ( CREATE TABLE SettingApplicationserviceDependency (
ApplicationserviceId INTEGER NOT NULL, ApplicationserviceId INTEGER NOT NULL,
ApplicationserviceDependencyId INTEGER NOT NULL, ApplicationserviceDependencyId INTEGER NOT NULL,
UNIQUE(ApplicationserviceId, ApplicationserviceDependencyId), UNIQUE(ApplicationserviceId, ApplicationserviceDependencyId),
FOREIGN KEY (ApplicationserviceId) REFERENCES Applicationservice(ApplicationserviceId), FOREIGN KEY (ApplicationserviceId) REFERENCES SettingApplicationservice(ApplicationserviceId),
FOREIGN KEY (ApplicationserviceDependencyId) REFERENCES Applicationservice(ApplicationserviceId) FOREIGN KEY (ApplicationserviceDependencyId) REFERENCES SettingApplicationservice(ApplicationserviceId)
); );
-- Log
CREATE TABLE log( CREATE TABLE log(
Msg VARCHAR(255) NOT NULL, Msg VARCHAR(255) NOT NULL,
Level VARCHAR(10) NOT NULL, Level VARCHAR(10) NOT NULL,
@ -134,8 +118,8 @@ CREATE TABLE log(
Data JSON, Data JSON,
Date timestamp DEFAULT current_timestamp Date timestamp DEFAULT current_timestamp
); );
-- User, Role and ACL
CREATE TABLE RisottoUser ( CREATE TABLE UserUser (
UserId SERIAL PRIMARY KEY, UserId SERIAL PRIMARY KEY,
UserLogin VARCHAR(100) NOT NULL UNIQUE, UserLogin VARCHAR(100) NOT NULL UNIQUE,
UserName VARCHAR(100) NOT NULL, UserName VARCHAR(100) NOT NULL,
@ -148,17 +132,17 @@ CREATE TABLE UserRole (
RoleName VARCHAR(255) NOT NULL, RoleName VARCHAR(255) NOT NULL,
RoleAttribute VARCHAR(255), RoleAttribute VARCHAR(255),
RoleAttributeValue VARCHAR(255), RoleAttributeValue VARCHAR(255),
FOREIGN KEY (RoleUserId) REFERENCES RisottoUser(UserId) FOREIGN KEY (RoleUserId) REFERENCES UserUser(UserId)
); );
CREATE TABLE URI ( CREATE TABLE UserURI (
URIId SERIAL PRIMARY KEY, URIId SERIAL PRIMARY KEY,
URIName VARCHAR(255) NOT NULL UNIQUE URIName VARCHAR(255) NOT NULL UNIQUE
); );
CREATE TABLE RoleURI ( CREATE TABLE UserRoleURI (
RoleName VARCHAR(255) NOT NULL, RoleName VARCHAR(255) NOT NULL,
URIId INTEGER NOT NULL, URIId INTEGER NOT NULL,
FOREIGN KEY (URIId) REFERENCES URI(URIId), FOREIGN KEY (URIId) REFERENCES UserURI(URIId),
PRIMARY KEY (RoleName, URIId) PRIMARY KEY (RoleName, URIId)
); );