From c153db8c473938a7dd9f8ce224ab5ce7d65a2903 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Tue, 28 Mar 2017 17:57:57 +0900 Subject: [PATCH] add pg and mysql database migrations --- store/datastore/ddl/mysql/13.sql | 46 +++++++++++++++++++++++++++ store/datastore/ddl/postgres/13.sql | 48 +++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 store/datastore/ddl/mysql/13.sql create mode 100644 store/datastore/ddl/postgres/13.sql diff --git a/store/datastore/ddl/mysql/13.sql b/store/datastore/ddl/mysql/13.sql new file mode 100644 index 000000000..a1c8c8035 --- /dev/null +++ b/store/datastore/ddl/mysql/13.sql @@ -0,0 +1,46 @@ +-- +migrate Up + +CREATE TABLE procs ( + proc_id INTEGER PRIMARY KEY AUTOINCREMENT +,proc_build_id INTEGER +,proc_pid INTEGER +,proc_ppid INTEGER +,proc_pgid INTEGER +,proc_name VARCHAR(250) +,proc_state VARCHAR(250) +,proc_error VARCHAR(500) +,proc_exit_code INTEGER +,proc_started INTEGER +,proc_stopped INTEGER +,proc_machine VARCHAR(250) +,proc_platform VARCHAR(250) +,proc_environ VARCHAR(2000) +,UNIQUE(proc_build_id, proc_pid) +,UNIQUE(proc_build_id, proc_name) +); + +CREATE INDEX proc_build_ix ON procs (proc_build_id); + +CREATE TABLE files ( + file_id INTEGER PRIMARY KEY AUTO_INCREMENT +,file_build_id INTEGER +,file_proc_id INTEGER +,file_name VARCHAR(250) +,file_mime VARCHAR(250) +,file_size INTEGER +,file_time INTEGER +,file_data MEDIUMBLOB +,UNIQUE(file_proc_id,file_name) +); + +CREATE INDEX file_build_ix ON files (file_build_id); +CREATE INDEX file_proc_ix ON files (file_proc_id); + +-- +migrate Down + +DROP INDEX file_build_ix; +DROP INDEX file_proc_ix; +DROP TABLE files; + +DROP INDEX proc_build_ix; +DROP TABLE procs; diff --git a/store/datastore/ddl/postgres/13.sql b/store/datastore/ddl/postgres/13.sql new file mode 100644 index 000000000..bf11aaa92 --- /dev/null +++ b/store/datastore/ddl/postgres/13.sql @@ -0,0 +1,48 @@ +-- +migrate Up + +CREATE TABLE procs ( + proc_id SERIAL PRIMARY KEY +,proc_build_id INTEGER +,proc_pid INTEGER +,proc_ppid INTEGER +,proc_pgid INTEGER +,proc_name VARCHAR(250) +,proc_state VARCHAR(250) +,proc_error VARCHAR(500) +,proc_exit_code INTEGER +,proc_started INTEGER +,proc_stopped INTEGER +,proc_machine VARCHAR(250) +,proc_platform VARCHAR(250) +,proc_environ VARCHAR(2000) + +,UNIQUE(proc_build_id, proc_pid) +,UNIQUE(proc_build_id, proc_name) +); + +CREATE INDEX proc_build_ix ON procs (proc_build_id); + +CREATE TABLE files ( + file_id SERIAL PRIMARY KEY +,file_build_id INTEGER +,file_proc_id INTEGER +,file_name VARCHAR(250) +,file_mime VARCHAR(250) +,file_size INTEGER +,file_time INTEGER +,file_data BYTEA + +,UNIQUE(file_proc_id,file_name) +); + +CREATE INDEX file_build_ix ON files (file_build_id); +CREATE INDEX file_proc_ix ON files (file_proc_id); + +-- +migrate Down + +DROP INDEX file_build_ix; +DROP INDEX file_proc_ix; +DROP TABLE files; + +DROP INDEX proc_build_ix; +DROP TABLE procs;