From b02fc2e1524e6163b88541680adf817f733f4849 Mon Sep 17 00:00:00 2001
From: linuxpoet <linuxpoet@4979c152-3d1c-0410-bac9-87ea11338e46>
Date: Sat, 9 Sep 2006 17:42:07 +0000
Subject: initial script for upgrade to 2.6.18. Adds primary key to acc_trans

git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@48 4979c152-3d1c-0410-bac9-87ea11338e46
---
 sql/Pg-upgrade-2.6.17-2.6.18.sql | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 sql/Pg-upgrade-2.6.17-2.6.18.sql

(limited to 'sql/Pg-upgrade-2.6.17-2.6.18.sql')

diff --git a/sql/Pg-upgrade-2.6.17-2.6.18.sql b/sql/Pg-upgrade-2.6.17-2.6.18.sql
new file mode 100644
index 00000000..693fed80
--- /dev/null
+++ b/sql/Pg-upgrade-2.6.17-2.6.18.sql
@@ -0,0 +1,11 @@
+-- adding primary key to acc_trans
+
+BEGIN;
+LOCK acc_trans in EXCLUSIVE mode;
+ALTER TABLE acc_trans ADD COLUMN entry_id bigint;
+CREATE SEQUENCE acctrans_entry_id_seq;
+ALTER TABLE acc_trans ALTER COLUMN entry_id SET DEFAULT nextval('acctrans_entry_id_seq');
+UPDATE acc_trans SET entry_id = nextval('acctrans_entry_id_seq');
+ALTER TABLE acc_trans ADD PRIMARY key (entry_id);
+COMMIT;
+
-- 
cgit v1.2.3

