From 356f3db32cd6cd315ef0ef5f81934b0a72a6fee9 Mon Sep 17 00:00:00 2001 From: Sara Bertocco <bertocco@oats.inaf.it> Date: Thu, 21 Jul 2016 17:55:50 +0200 Subject: [PATCH] Complete database description --- src/main/java/sql/create_vospace_backend.sql | 142 ++++++++++++++++++- 1 file changed, 136 insertions(+), 6 deletions(-) diff --git a/src/main/java/sql/create_vospace_backend.sql b/src/main/java/sql/create_vospace_backend.sql index ef96111..b735396 100644 --- a/src/main/java/sql/create_vospace_backend.sql +++ b/src/main/java/sql/create_vospace_backend.sql @@ -1,4 +1,3 @@ - /**_____________________________________________________________________________ * * OATS - INAF @@ -23,12 +22,27 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * _____________________________________________________________________________ **/ -CREATE DATABASE vosbackend; -use vosbackend; +/* +This file contains the complete database needed to run a VOSpace: +the VOSpace front-end tables to manage stored files metadata +the VOSpace back-end tables to manage stored files +the UWS tables to manage Job metadata +*/ + +/* + DataBase creation and grant assignment +*/ + +CREATE DATABASE cadctest; + +use cadctest; -grant all on vosbackend.* to 'vosbackadmin' identified by 'Peper0ne'; +grant all on cadctest.* to 'oatsops' identified by 'Peper0ne'; +/* + VOSpace back-end +*/ CREATE TABLE StoredFiles ( fileID int NOT NULL AUTO_INCREMENT, @@ -38,10 +52,126 @@ CREATE TABLE StoredFiles PRIMARY KEY (fileID) ) ENGINE=InnoDB; -CREATE TABLE NodeStoredFileAndNode + +CREATE TABLE StoredFileAndNode ( - storedFileID varchar(255) NOT NULL, + storedFileID varchar(255) NOT NULL, nodeID BIGINT(20) NOT NULL, PRIMARY KEY (storedFileID) ) ENGINE=InnoDB; + + +/* + VOSpace front-end +*/ + +CREATE TABLE Node +( + nodeID BIGINT(20) NOT NULL AUTO_INCREMENT, + parentID BIGINT(20) default NULL, + name VARCHAR(256) NOT NULL, + type CHAR(1) NOT NULL, + busyState CHAR(1) NOT NULL, + ownerID INT(40) NOT NULL, + creatorID INT(40) NOT NULL, + groupRead VARCHAR(256) default NULL, + groupWrite VARCHAR(256) default NULL, + isPublic BIT(1) NOT NULL, + isLocked BIT(1) NOT NULL, + delta BIGINT(20) default NULL, + contentType VARCHAR(100) default NULL, + contentEncoding VARCHAR(50) default NULL, + contentLength BIGINT(20) default NULL, + contentMD5 BINARY(16) default NULL, + createdOn DATETIME default CURRENT_TIMESTAMP, + lastModified DATETIME NOT NULL, + link TEXT default NULL, + PRIMARY KEY (nodeID) +) ENGINE=InnoDB; + + +CREATE TABLE NodeProperty +( + nodeID BIGINT(20) NOT NULL, + propertyURI VARCHAR(256) NOT NULL, + propertyValue VARCHAR(512) default NULL, + lastModified DATETIME default CURRENT_TIMESTAMP, +-- support replication with a fake primary key + _rep_support bigint(20) NOT NULL PRIMARY KEY, + foreign key (nodeID) references Node (nodeID) +) ENGINE=InnoDB; + + +CREATE TABLE DeletedNode +( + nodeID bigint(20) NOT NULL + name varchar(276) NOT NULL, + ownerID varchar(256) NOT NULL, + lastModified DATETIME NOT NULL, + PRIMARY KEY (nodeID) +) ENGINE=InnoDB; + + +/* + UWS +*/ + +create table Job +( + jobID varchar(16) NOT NULL, + runID varchar(128), + +-- suitable column when using the X500IdentityManager + ownerID varchar(128), + + executionPhase varchar(16) not null, + executionDuration bigint (20) not null, + destructionTime DATETIME, + quote DATETIME, + startTime DATETIME, + endTime DATETIME, + error_summaryMessage varchar(1024), + error_type varchar(16), + error_documentURL varchar(128), + requestPath varchar(128), + remoteIP varchar(20), + jobInfo_content varchar(1000) + jobInfo_contentType varchar(128), + jobInfo_valid smallint(6), + deletedByUser smallint(6) default 0, + lastModified DATETIME not null, + primary key (jobID) +) ENGINE=InnoDB; + + +create table JobDetail +( + jobID varchar(16) not null, + type char(1) not null, + name varchar(128) not null, + value varchar(128), + + foreign key (jobID) references Job (jobID) +) ENGINE=InnoDB; + +create index uws_param_i1 on JobDetail(jobID); + +/* + Initialize root node for vospace +*/ + +insert into Node (name, parentID, type, busyState, ownerID, creatorID, groupRead, groupWrite, isPublic, isLocked,lastModified) values ('vospaceRootNode', NULL, 'C', 'N', '123456789', '123456789', 'inaf-ops', 'inaf-ops', 1, 0, '2016-04-15 11:51:09'); + + +/* Should be: + +select * from Node where name='MyVoNode'; ++--------+----------+----------+------+-----------+-----------+-----------+-----------+------------+----------+----------+-------+-------------+-----------------+---------------+------------+---------------------+---------------------+------+ +| nodeID | parentID | name | type | busyState | ownerID | creatorID | groupRead | groupWrite | isPublic | isLocked | delta | contentType | contentEncoding | contentLength | contentMD5 | createdOn | lastModified | link | ++--------+----------+----------+------+-----------+-----------+-----------+-----------+------------+----------+----------+-------+-------------+-----------------+---------------+------------+---------------------+---------------------+------+ +| 1 | NULL | myVONode | C | N | 123456789 | 123456789 | inaf-ops | inaf-ops | | | NULL | NULL | NULL | NULL | NULL | 2016-07-01 13:19:07 | 2016-06-30 11:51:09 | NULL | ++--------+----------+----------+------+-----------+-----------+-----------+-----------+------------+----------+--------- + +where 123456789 is the numeric ID of the owner (admin) in the ldap server and inaf-ops is a group in ldap belongind to ldap admin groups. 123456789 must belong to the group inaf-ops +*/ \ No newline at end of file -- GitLab