From 07cefc9fbfcd17457b51914d4d7b58ad2416fc18 Mon Sep 17 00:00:00 2001 Message-Id: <07cefc9fbfcd17457b51914d4d7b58ad2416fc18.1714376716.git.mdw@distorted.org.uk> From: Mark Wooding Date: Fri, 24 Jul 2015 18:58:24 +0100 Subject: [PATCH] sql/update-*-v2.sql: Scripts to upgrade existing database schemata. Organization: Straylight/Edgeware From: Mark Wooding --- sql/update-pastebin-v2.sql | 16 ++++++++++++++++ sql/update-shorturl-v2.sql | 15 +++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 sql/update-pastebin-v2.sql create mode 100644 sql/update-shorturl-v2.sql diff --git a/sql/update-pastebin-v2.sql b/sql/update-pastebin-v2.sql new file mode 100644 index 0000000..be7d2e7 --- /dev/null +++ b/sql/update-pastebin-v2.sql @@ -0,0 +1,16 @@ +/* -*-sql-*- + * + * Plain old SQL for setting up the tables for Odin web services. + */ + +begin; +alter table odin_pastebin alter column lang set default 'txt'; +alter table odin_pastebin rename column stamp to oldstamp; +alter table odin_pastebin add column stamp bigint not null default 0; +update odin_pastebin set stamp = extract(epoch from oldstamp); +commit; + +begin; +alter table odin_pastebin drop column oldstamp; +alter table odin_pastebin alter column stamp drop default; +commit; diff --git a/sql/update-shorturl-v2.sql b/sql/update-shorturl-v2.sql new file mode 100644 index 0000000..2165d62 --- /dev/null +++ b/sql/update-shorturl-v2.sql @@ -0,0 +1,15 @@ +/* -*-sql-*- + * + * Plain old SQL for setting up the tables for Odin web services. + */ + +begin; +alter table odin_shorturl rename column stamp to oldstamp; +alter table odin_shorturl add column stamp bigint not null default 0; +update odin_shorturl set stamp = extract(epoch from oldstamp); +commit; + +begin; +alter table odin_shorturl drop column oldstamp; +alter table odin_shorturl alter column stamp drop default; +commit; -- [mdw]