From 9bfab51e00608b6e008aa71f6df74104b28fc662 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 28 Mar 2015 18:00:18 -0400 Subject: Add currency rates for budget calculation --- app/Schema/Postgres.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'app/Schema/Postgres.php') 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 )"); } -- cgit v1.2.3