Permalink
Fetching contributors…
Cannot retrieve contributors at this time
21 lines (20 sloc) 2.92 KB
CREATE SCHEMA PUBLIC AUTHORIZATION DBA
CREATE MEMORY TABLE COURSE(ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,COURSE_TYPE VARCHAR(255) NOT NULL,DESCRIPTION VARCHAR(1000) NOT NULL,LIST_PRICE NUMERIC NOT NULL,MAX_CAPACITY INTEGER NOT NULL,COURSE_NAME VARCHAR(60),RUN_DATE TIMESTAMP,VERSION INTEGER,TRAINING_PROGRAM BIGINT)
CREATE MEMORY TABLE INSTRUCTOR(ID BIGINT NOT NULL PRIMARY KEY,ADDRESS_LINE1 VARCHAR(60) NOT NULL,ADDRESS_LINE2 VARCHAR(60),CITY VARCHAR(40),EMAIL_ADDRESS VARCHAR(80) NOT NULL,FIRST_NAME VARCHAR(30),MIDDLE_NAME_OR_INITIAL VARCHAR(30),POSTAL_CODE VARCHAR(10) NOT NULL,STATE_CODE VARCHAR(2),VERSION INTEGER,ACTIVE BOOLEAN,TAX_NUMBER VARCHAR(9) NOT NULL)
CREATE MEMORY TABLE OFFERING(ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,LOCATION_NAME VARCHAR(80) NOT NULL,OFFER_DATE TIMESTAMP NOT NULL,VERSION INTEGER,COURSE BIGINT,INSTRUCTOR BIGINT,CONSTRAINT FKD2311006A8423C66 FOREIGN KEY(INSTRUCTOR) REFERENCES INSTRUCTOR(ID),CONSTRAINT FKD23110069CBA5162 FOREIGN KEY(COURSE) REFERENCES COURSE(ID))
CREATE MEMORY TABLE REGISTRATION(ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,ATTENDED BOOLEAN,PAYMENT_MADE BOOLEAN,VERSION INTEGER,COURSE BIGINT,STUDENT BIGINT,CONSTRAINT FKAF83E8B99CBA5162 FOREIGN KEY(COURSE) REFERENCES COURSE(ID))
CREATE MEMORY TABLE STUDENT(ID BIGINT NOT NULL PRIMARY KEY,ADDRESS_LINE1 VARCHAR(60) NOT NULL,ADDRESS_LINE2 VARCHAR(60),CITY VARCHAR(40),EMAIL_ADDRESS VARCHAR(80) NOT NULL,FIRST_NAME VARCHAR(30),MIDDLE_NAME_OR_INITIAL VARCHAR(30),POSTAL_CODE VARCHAR(10) NOT NULL,STATE_CODE VARCHAR(2),VERSION INTEGER,DIETARY_RESTRICTIONS VARCHAR(30),EMERGENCY_CONTACT_INFO VARCHAR(80) NOT NULL,EMERGENCY_CONTACT_NAME VARCHAR(30) NOT NULL)
CREATE MEMORY TABLE TAG(ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,DESCRIPTION VARCHAR(250) NOT NULL,TAG VARCHAR(25) NOT NULL,VERSION INTEGER)
CREATE MEMORY TABLE TAG_COURSES(TAGS BIGINT NOT NULL,COURSES BIGINT NOT NULL,PRIMARY KEY(TAGS,COURSES),CONSTRAINT FK74A650135994D207 FOREIGN KEY(TAGS) REFERENCES TAG(ID),CONSTRAINT FK74A65013269094FF FOREIGN KEY(COURSES) REFERENCES COURSE(ID))
CREATE MEMORY TABLE TRAINING_PROGRAM(ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,NAME VARCHAR(255),VERSION INTEGER)
CREATE MEMORY TABLE HIBERNATE_SEQUENCES(SEQUENCE_NAME VARCHAR(255),SEQUENCE_NEXT_HI_VALUE INTEGER)
ALTER TABLE COURSE ADD CONSTRAINT FKAF42E01BFFCA38BD FOREIGN KEY(TRAINING_PROGRAM) REFERENCES TRAINING_PROGRAM(ID)
ALTER TABLE REGISTRATION ADD CONSTRAINT FKAF83E8B9A85A98CA FOREIGN KEY(STUDENT) REFERENCES STUDENT(ID)
ALTER TABLE COURSE ALTER COLUMN ID RESTART WITH 1
ALTER TABLE OFFERING ALTER COLUMN ID RESTART WITH 1
ALTER TABLE REGISTRATION ALTER COLUMN ID RESTART WITH 1
ALTER TABLE TAG ALTER COLUMN ID RESTART WITH 1
ALTER TABLE TRAINING_PROGRAM ALTER COLUMN ID RESTART WITH 1
CREATE USER SA PASSWORD ""
GRANT DBA TO SA
SET WRITE_DELAY 10