summaryrefslogtreecommitdiff
path: root/app/Schema/Postgres.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-03-28 18:00:18 -0400
committerFrederic Guillot <fred@kanboard.net>2015-03-28 18:00:18 -0400
commit9bfab51e00608b6e008aa71f6df74104b28fc662 (patch)
treec390346c8ed384c78bf85bbdd950d70bd9a9ab51 /app/Schema/Postgres.php
parenteb6853c163e9059bbbc89a1a741d4a25c8e04153 (diff)
Add currency rates for budget calculation
Diffstat (limited to 'app/Schema/Postgres.php')
-rw-r--r--app/Schema/Postgres.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php
index ecf8664d..dc4afff3 100644
--- a/app/Schema/Postgres.php
+++ b/app/Schema/Postgres.php
@@ -6,7 +6,15 @@ use PDO;
use Core\Security;
use Model\Link;
-const VERSION = 37;
+const VERSION = 38;
+
+function version_38($pdo)
+{
+ $pdo->exec('CREATE TABLE currencies ("currency" CHAR(3) NOT NULL UNIQUE, "rate" REAL DEFAULT 0)');
+
+ $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');
+ $rq->execute(array('application_currency', 'USD'));
+}
function version_37($pdo)
{
@@ -109,7 +117,7 @@ function version_31($pdo)
user_id INTEGER NOT NULL,
rate REAL DEFAULT 0,
date_effective INTEGER NOT NULL,
- currency TEXT NOT NULL,
+ currency CHAR(3) NOT NULL,
FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
)");
}