From a7e1392f53d07e4827dff0b901b5cf2f3a0e2392 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Sun, 11 Aug 2013 15:05:46 -0500 Subject: [PATCH] Adding migration for OTP field --- indefero/src/IDF/Migrations/28OTPKey.php | 36 ++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 indefero/src/IDF/Migrations/28OTPKey.php diff --git a/indefero/src/IDF/Migrations/28OTPKey.php b/indefero/src/IDF/Migrations/28OTPKey.php new file mode 100644 index 0000000..24f93d1 --- /dev/null +++ b/indefero/src/IDF/Migrations/28OTPKey.php @@ -0,0 +1,36 @@ +getSqlTable(); + + $sql = array(); + + $sql["MySQL"] = "ALTER TABLE " . $table . " ADD COLUMN `otpkey` VARCHAR(50) NULL AFTER `last_login`;"; + + $db = Pluf::db(); + $engine = Pluf::f('db_engine'); + if (!isset($sql[$engine])) { + throw new Exception('SQLite complex migration not supported.'); + } + + $db->execute($sql[$engine]); + +} + +function IDF_Migrations_28OTPKey_down() +{ + $table = Pluf::factory('Pluf_User')->getSqlTable(); + + $sql = array(); + + $sql["MySQL"] = "ALTER TABLE " . $table . " DROP COLUMN `otpkey`;"; + + $db = Pluf::db(); + $engine = Pluf::f('db_engine'); + if (!isset($sql[$engine])) { + throw new Exception('SQLite complex migration not supported.'); + } + + $db->execute($sql[$engine]); +} \ No newline at end of file