diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2013-04-30 07:12:56 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2013-04-30 07:12:56 +0200 |
commit | 0a0b01664cf620f983549999b24a7740594a57d4 (patch) | |
tree | 3a226f4e33ec986f3bae598a547690b3f99e2e8d /src/main/resources | |
download | jdbc-queue-master.tar.gz jdbc-queue-master.tar.bz2 jdbc-queue-master.tar.xz jdbc-queue-master.zip |
Diffstat (limited to 'src/main/resources')
-rw-r--r-- | src/main/resources/create.sql | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/main/resources/create.sql b/src/main/resources/create.sql new file mode 100644 index 0000000..ed8913f --- /dev/null +++ b/src/main/resources/create.sql @@ -0,0 +1,27 @@ +BEGIN; + +DROP TABLE IF EXISTS task; +DROP TABLE IF EXISTS queue; +DROP SEQUENCE IF EXISTS task_id; + +CREATE TABLE queue ( + name VARCHAR(100) NOT NULL, + interval INTEGER NOT NULL, + CONSTRAINT pk_queue PRIMARY KEY (name) +); + +CREATE TABLE task ( + id INTEGER NOT NULL, + queue VARCHAR(100) NOT NULL, + scheduled TIMESTAMP NOT NULL, + last_run TIMESTAMP, + run_count INT NOT NULL, + completed TIMESTAMP, + arguments VARCHAR(100), + CONSTRAINT pk_task PRIMARY KEY (id), + CONSTRAINT fk_task__queue FOREIGN KEY (queue) REFERENCES queue (name) +); + +CREATE SEQUENCE task_id; + +COMMIT; |