This repository has been archived by the owner on Jan 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
prodDb.script
18 lines (18 loc) · 1.7 KB
/
prodDb.script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
CREATE SCHEMA PUBLIC AUTHORIZATION DBA
CREATE MEMORY TABLE ORGANISATION(ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,VERSION BIGINT NOT NULL,FAX_NUMBER VARCHAR(255) NOT NULL,NAME VARCHAR(255) NOT NULL,PHONE_NUMBER VARCHAR(255) NOT NULL,POSTAL_ADDRESS VARCHAR(255) NOT NULL)
CREATE MEMORY TABLE PROJECT(ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,VERSION BIGINT NOT NULL,DESCRIPTION VARCHAR(255) NOT NULL,NAME VARCHAR(255) NOT NULL)
CREATE MEMORY TABLE PROJECT_ORGANISATION(PROJECT_ORGANISATION_ID BIGINT,ORGANISATION_ID BIGINT,CONSTRAINT FK621CB040AE9E1A25 FOREIGN KEY(PROJECT_ORGANISATION_ID) REFERENCES PROJECT(ID),CONSTRAINT FK621CB0401D0F4128 FOREIGN KEY(ORGANISATION_ID) REFERENCES ORGANISATION(ID))
CREATE MEMORY TABLE ORGANISATION_PROJECT(ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,VERSION BIGINT NOT NULL,ORGANISATION_ID BIGINT NOT NULL,PROJECT_ID BIGINT NOT NULL,CONSTRAINT FKF3B978B4D0AEE4AC FOREIGN KEY(PROJECT_ID) REFERENCES PROJECT(ID),CONSTRAINT FKF3B978B41D0F4128 FOREIGN KEY(ORGANISATION_ID) REFERENCES ORGANISATION(ID))
ALTER TABLE ORGANISATION ALTER COLUMN ID RESTART WITH 3
ALTER TABLE PROJECT ALTER COLUMN ID RESTART WITH 2
ALTER TABLE ORGANISATION_PROJECT ALTER COLUMN ID RESTART WITH 4
CREATE USER SA PASSWORD ""
GRANT DBA TO SA
SET WRITE_DELAY 10
SET SCHEMA PUBLIC
INSERT INTO ORGANISATION VALUES(1,0,'1234','IMOS','5678','12 asdf road')
INSERT INTO ORGANISATION VALUES(2,0,'124','CSIRO','34','12 adsgf')
INSERT INTO PROJECT VALUES(1,0,'the description','count seals')
INSERT INTO ORGANISATION_PROJECT VALUES(1,0,1,1)
INSERT INTO ORGANISATION_PROJECT VALUES(2,0,2,1)
INSERT INTO ORGANISATION_PROJECT VALUES(3,0,1,1)