-- ============================

-- This file was created using Derby's dblook utility.
-- Timestamp: 2005-08-08 09:29:37.598
-- Source database is: /opt/gt401/database/system/rftDatabase
-- Connection URL is: jdbc:derby:/opt/gt401/database/system/rftDatabase
-- appendLogs: false


-- Tell IJ what driver and protocol, then connect to the database...

-- Driver 'org.apache.derby.jdbc.ClientDriver';
-- Protocol 'jdbc:derby:';
--connect 'rftDatabase';

-- ----------------------------------------------
-- DDL Statements for schemas
-- ----------------------------------------------

CREATE SCHEMA "GLOBUS";

-- ----------------------------------------------
-- DDL Statements for tables
-- ----------------------------------------------

CREATE TABLE "GLOBUS"."REQUEST" (
	"ID" INTEGER NOT NULL, 
	"CONCURRENCY" INTEGER DEFAULT 1, 
	"TERMINATION_TIME" DOUBLE, 
	"PROXY_LOC" VARCHAR(200), 
	"USERNAME" VARCHAR(200), 
	"STARTED" CHAR(1) DEFAULT 'F', 
	"ALL_OR_NONE" CHAR(1) DEFAULT 'F', 
	"MAXATTEMPTS" INTEGER DEFAULT 1, 
	"DELEGATED_EPR" VARCHAR(1255), 
	"USER_SUBJECT" VARCHAR(200));

CREATE TABLE "GLOBUS"."TRANSFER" (
	"ID" INTEGER NOT NULL, 
	"REQUEST_ID" INTEGER NOT NULL, 
	"SOURCE_URL" VARCHAR(200) NOT NULL, 
	"DEST_URL" VARCHAR(200), 
	"STATUS" INTEGER DEFAULT 4, 
	"ATTEMPTS" INTEGER DEFAULT 0, 
	"USER_NAME" VARCHAR(100) DEFAULT NULL, 
	"DCAU" CHAR(1) DEFAULT 'T', 
	"PARALLEL_STREAMS" INTEGER DEFAULT 1, 
	"TCP_BUFFER_SIZE" INTEGER DEFAULT 0, 
	"BLOCK_SIZE" INTEGER DEFAULT 16000, 
	"NOTPT" CHAR(1) DEFAULT 'F', 
	"BINARY_MODE" CHAR(1) DEFAULT 'T', 
	"SOURCE_SUBJECT" VARCHAR(200), 
	"DEST_SUBJECT" VARCHAR(200), 
	"RETRY_TIME" DOUBLE DEFAULT 0, 
	"SIZE" DOUBLE DEFAULT 0, 
	"FAULT" VARCHAR(255), 
	"PERMISSIONS" VARCHAR(100), 
	"IGNORE_FILE_PERM_ERRORS" CHAR(1) DEFAULT 'F'
	);

CREATE TABLE "GLOBUS"."TRANSFERID" (
	"TRANSFER_ID" INTEGER NOT NULL
	);

CREATE TABLE "GLOBUS"."FACTORY" (
	"TOTAL_TRANSFERS" DOUBLE, 
	"TOTAL_BYTES" DOUBLE
	);

CREATE TABLE "GLOBUS"."RESTART" (
	"TRANSFER_ID" INTEGER, 
	"MARKER" VARCHAR(200)
	);

CREATE TABLE "GLOBUS"."REQUESTID" (
	"REQUEST_ID" INTEGER NOT NULL
	);

-- ----------------------------------------------
-- DDL Statements for keys
-- ----------------------------------------------

-- primary/unique
ALTER TABLE "GLOBUS"."TRANSFER" ADD CONSTRAINT "TRANSFER_PK_CONS" PRIMARY KEY ("ID");

ALTER TABLE "GLOBUS"."REQUEST" ADD CONSTRAINT "REQUEST_PK_CONS" PRIMARY KEY ("ID");

ALTER TABLE "GLOBUS"."TRANSFERID" ADD CONSTRAINT "TRANSFER_ID_PK_CONS" PRIMARY KEY ("TRANSFER_ID");

ALTER TABLE "GLOBUS"."REQUESTID" ADD CONSTRAINT "REQUEST_ID_PK_CONS" PRIMARY KEY ("REQUEST_ID");

