From a63ec924e5440b17434ecc91e84d1419ae39ef2a Mon Sep 17 00:00:00 2001
From: Trygve Laugstøl <trygvis@inamo.no>
Date: Fri, 21 Dec 2012 22:24:41 +0100
Subject: o Adding a sequence number to jenkins_build. o Making the table
 poller poll based on a sequence number instead.

---
 src/main/resources/ddl-core.sql    | 10 +++++-----
 src/main/resources/ddl-jenkins.sql |  7 ++++++-
 2 files changed, 11 insertions(+), 6 deletions(-)

(limited to 'src/main/resources')

diff --git a/src/main/resources/ddl-core.sql b/src/main/resources/ddl-core.sql
index 25f373b..9dcdd09 100644
--- a/src/main/resources/ddl-core.sql
+++ b/src/main/resources/ddl-core.sql
@@ -9,11 +9,11 @@ DROP TABLE IF EXISTS person;
 DROP TABLE IF EXISTS table_poller_status;
 
 CREATE TABLE table_poller_status (
-  poller_name       VARCHAR(100) NOT NULL,
-  last_created_date TIMESTAMP,
-  last_run          TIMESTAMP,
-  duration          INT,
-  status            VARCHAR(1000),
+  poller_name VARCHAR(100) NOT NULL,
+  last_seq    INT          NOT NULL,
+  last_run    TIMESTAMP,
+  duration    INT,
+  status      VARCHAR(1000),
   CONSTRAINT pk_job_status PRIMARY KEY (poller_name)
 );
 
diff --git a/src/main/resources/ddl-jenkins.sql b/src/main/resources/ddl-jenkins.sql
index bdda74b..94bfc4e 100644
--- a/src/main/resources/ddl-jenkins.sql
+++ b/src/main/resources/ddl-jenkins.sql
@@ -7,8 +7,10 @@ DROP TABLE IF EXISTS jenkins_server;
 CREATE TABLE jenkins_server (
   uuid         CHAR(36)      NOT NULL,
   created_date TIMESTAMP     NOT NULL,
+
   url          VARCHAR(1000) NOT NULL,
   enabled      BOOLEAN       NOT NULL,
+
   CONSTRAINT pk_jenkins_server PRIMARY KEY (uuid),
   CONSTRAINT uq_jenkins_server__url UNIQUE (url)
 );
@@ -31,6 +33,7 @@ CREATE TABLE jenkins_job (
 CREATE TABLE jenkins_build (
   uuid         CHAR(36)      NOT NULL,
   created_date TIMESTAMP     NOT NULL,
+  seq          INT           NOT NULL DEFAULT nextval('jenkins_build_seq'),
 
   job          CHAR(36)      NOT NULL,
 
@@ -44,7 +47,8 @@ CREATE TABLE jenkins_build (
 
   CONSTRAINT pk_jenkins_build PRIMARY KEY (UUID),
   CONSTRAINT fk_jenkins_build__job FOREIGN KEY (job) REFERENCES jenkins_job (uuid),
-  CONSTRAINT uq_jenkins_build__id UNIQUE (entry_id)
+  CONSTRAINT uq_jenkins_build__id UNIQUE (entry_id),
+  CONSTRAINT uq_jenkins_build__seq UNIQUE (seq)
 );
 
 CREATE INDEX ix_jenkins_build__created_date ON jenkins_build (created_date);
@@ -52,6 +56,7 @@ CREATE INDEX ix_jenkins_build__created_date ON jenkins_build (created_date);
 CREATE TABLE jenkins_user (
   uuid         CHAR(36)      NOT NULL,
   created_date TIMESTAMP     NOT NULL,
+
   server       CHAR(36)      NOT NULL,
   absolute_url VARCHAR(1000) NOT NULL,
   CONSTRAINT pk_jenkins_user PRIMARY KEY (uuid),
-- 
cgit v1.2.3