From 62d926e022aaf35be029f20568e55533caee3bf7 Mon Sep 17 00:00:00 2001
From: Ian C <ianc@noddybox.co.uk>
Date: Sat, 7 Jul 2018 13:26:02 +0000
Subject: Added up/down links to reorder entries.

---
 sql/INSTALL                    |  4 ++++
 sql/create_db.sh               |  1 +
 sql/upgrade_from_1.0_to_1.1.sh | 26 ++++++++++++++++++++++++++
 3 files changed, 31 insertions(+)
 create mode 100755 sql/upgrade_from_1.0_to_1.1.sh

(limited to 'sql')

diff --git a/sql/INSTALL b/sql/INSTALL
index 340d656..624a1c8 100644
--- a/sql/INSTALL
+++ b/sql/INSTALL
@@ -1,2 +1,6 @@
 Run the ./create_db.sh shell script to create the database.  You will have to
 enter the MySQL root user password when prompted.
+
+If you are upgrading from a previous version run the appropriate upgrade script:
+
+upgrade_from_1.0_to_1.1.sh	- Upgrade from V1.0 to V1.1
diff --git a/sql/create_db.sh b/sql/create_db.sh
index 69639db..9d55d63 100755
--- a/sql/create_db.sh
+++ b/sql/create_db.sh
@@ -52,6 +52,7 @@ grant all on *.* to '$uname'@'localhost' identified by '$pword';
 create table pm_store
 (
     id int not null auto_increment,
+    display int not null,
     description varchar(1024) not null,
     groupname varchar(512) not null,
     username varchar(512) not null,
diff --git a/sql/upgrade_from_1.0_to_1.1.sh b/sql/upgrade_from_1.0_to_1.1.sh
new file mode 100755
index 0000000..78c1468
--- /dev/null
+++ b/sql/upgrade_from_1.0_to_1.1.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+dbname="passman"
+echo "Name of database to use [$dbname]:"
+read x
+
+if [ "$x" ] ; then
+    dbname=$x
+fi
+
+script=/tmp/$$
+rm -f $script
+touch $script
+
+cat >> $script << END_OF_SQL
+
+use $dbname;
+alter table pm_store add column display int not null;
+update pm_store set display = id;
+
+END_OF_SQL
+
+cat -n $script
+mysql -u root -p < $script
+
+rm -f $script
-- 
cgit v1.2.3