Adding migration for OTP field

master
Nathan Adams 2013-08-11 15:05:46 -05:00
parent 3f69ca67b7
commit a7e1392f53
1 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,36 @@
<?php
function IDF_Migrations_28OTPKey_up()
{
$table = Pluf::factory('Pluf_User')->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]);
}