Project

General

Profile

1
/*
2
 * db_version -- table to store the version history of this database
3
 */
4
CREATE TABLE db_version (
5
  db_version_id   NUMBER(20),       -- the identifier for the version
6
  version         VARCHAR(250),     -- the version number
7
  status          NUMBER(20),       -- status of the version
8
  date_created    DATE,             -- the datetime on which the version was created
9
  CONSTRAINT db_version_pk PRIMARY KEY (db_version_id)
10
);
11

    
12
CREATE SEQUENCE db_version_id_seq;
13
CREATE TRIGGER db_version_before_insert
14
BEFORE INSERT ON db_version FOR EACH ROW
15
BEGIN
16
  SELECT db_version_id_seq.nextval
17
    INTO :new.db_version_id
18
    FROM dual;
19
END;
20
/
21

    
22
INSERT INTO db_version (version, status, date_created) 
23
  VALUES ('1.8.0', 1, CURRENT_DATE);
(35-35/40)