POSTGRESQL
CREATE TABLE IF NOT EXISTS scm_activity ( id bigserial NOT NULL, issuekey VARCHAR(50) NOT NULL, issueid BIGINT NOT NULL DEFAULT 0, changeid VARCHAR(50) NOT NULL, changedate VARCHAR(50) NOT NULL, changeauthor VARCHAR(50) NOT NULL, changelink VARCHAR(255) NULL, changetype VARCHAR(50) NOT NULL, changebranch VARCHAR(255) NULL, changetag VARCHAR(50) NULL, changestatus VARCHAR(50) NULL, PRIMARY KEY (id) ); CREATE TABLE IF NOT EXISTS scm_message ( id bigserial NOT NULL, scmactivityid BIGINT NOT NULL, message TEXT NULL, PRIMARY KEY (id), CONSTRAINT FK_scm_message_activity FOREIGN KEY (scmactivityid) REFERENCES scm_activity(id) ON DELETE CASCADE ); CREATE TABLE IF NOT EXISTS scm_files ( id bigserial NOT NULL, scmactivityid BIGINT NOT NULL, filename VARCHAR(255) NOT NULL, fileaction VARCHAR(50) NOT NULL, fileversion VARCHAR(50) NULL, PRIMARY KEY (id), CONSTRAINT FK_scm_files_activity FOREIGN KEY (scmactivityid) REFERENCES scm_activity (id) ON DELETE CASCADE ); CREATE TABLE IF NOT EXISTS scm_job ( id bigserial NOT NULL, scmactivityid BIGINT NOT NULL, jobname VARCHAR(255) NOT NULL, joblink VARCHAR(255) NULL, jobstatus VARCHAR(50) NULL, PRIMARY KEY (id), CONSTRAINT FK_scm_job_activity FOREIGN KEY (scmactivityid) REFERENCES scm_activity (id) ON DELETE CASCADE );