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