summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/account-server/dalstorage.cpp2
-rw-r--r--src/sql/sqlite/createTables.sql20
-rw-r--r--src/sql/sqlite/updates/update_3_to_4.sql13
3 files changed, 25 insertions, 10 deletions
diff --git a/src/account-server/dalstorage.cpp b/src/account-server/dalstorage.cpp
index d27413d9..ec7158e5 100644
--- a/src/account-server/dalstorage.cpp
+++ b/src/account-server/dalstorage.cpp
@@ -41,7 +41,7 @@
// defines the supported db version
#define DB_VERSION_PARAMETER "database_version"
-#define SUPPORTED_DB_VERSION "3"
+#define SUPPORTED_DB_VERSION "4"
/**
diff --git a/src/sql/sqlite/createTables.sql b/src/sql/sqlite/createTables.sql
index 1831c45a..682a94d4 100644
--- a/src/sql/sqlite/createTables.sql
+++ b/src/sql/sqlite/createTables.sql
@@ -1,13 +1,15 @@
CREATE TABLE tmw_accounts
(
- id INTEGER PRIMARY KEY,
- username TEXT NOT NULL UNIQUE,
- password TEXT NOT NULL,
- email TEXT NOT NULL,
- level INTEGER NOT NULL,
- banned INTEGER NOT NULL,
- registration INTEGER NOT NULL,
- lastlogin INTEGER NOT NULL
+ id INTEGER PRIMARY KEY,
+ username TEXT NOT NULL UNIQUE,
+ password TEXT NOT NULL,
+ email TEXT NOT NULL,
+ level INTEGER NOT NULL,
+ banned INTEGER NOT NULL,
+ registration INTEGER NOT NULL,
+ lastlogin INTEGER NOT NULL,
+ authorization TEXT NULL,
+ expiration INTEGER NULL
);
CREATE UNIQUE INDEX tmw_accounts_username ON tmw_accounts ( username );
@@ -142,7 +144,7 @@ CREATE TABLE tmw_world_states
INSERT INTO tmw_world_states VALUES('accountserver_startup',NULL,NULL, strftime('%s','now'));
INSERT INTO tmw_world_states VALUES('accountserver_version',NULL,NULL, strftime('%s','now'));
-INSERT INTO tmw_world_states VALUES('database_version', NULL,'3', strftime('%s','now'));
+INSERT INTO tmw_world_states VALUES('database_version', NULL,'4', strftime('%s','now'));
CREATE TABLE tmw_auctions
(
diff --git a/src/sql/sqlite/updates/update_3_to_4.sql b/src/sql/sqlite/updates/update_3_to_4.sql
new file mode 100644
index 00000000..94d2edd4
--- /dev/null
+++ b/src/sql/sqlite/updates/update_3_to_4.sql
@@ -0,0 +1,13 @@
+
+-- add two columns to table tmw_accounts
+ALTER TABLE tmw_accounts ADD
+ authorization TEXT NULL,
+ expiration INTEGER NULL
+;
+
+-- update the database version, and set date of update
+UPDATE tmw_world_states
+ SET value = '4',
+ moddate = strftime('%s','now')
+ WHERE state_name = 'database_version';
+