diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-11-04 21:33:05 -0500 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-11-04 21:33:05 -0500 |
commit | 135b921db75da5995eab7e36393ecd4d2b0bc66f (patch) | |
tree | 46efc60fcf1f9d5c57ab1fb9418c2acfbda0698a /vendor/PicoDb/Schema.php | |
parent | 850645dd6b22f5b495d1680e0b49540e0ebf9bd3 (diff) |
Switch to composer
Diffstat (limited to 'vendor/PicoDb/Schema.php')
-rw-r--r-- | vendor/PicoDb/Schema.php | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/vendor/PicoDb/Schema.php b/vendor/PicoDb/Schema.php deleted file mode 100644 index a054ac09..00000000 --- a/vendor/PicoDb/Schema.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php - -namespace PicoDb; - -class Schema -{ - protected $db = null; - - - public function __construct(Database $db) - { - $this->db = $db; - } - - - public function check($last_version = 1) - { - $current_version = $this->db->getConnection()->getSchemaVersion(); - - if ($current_version < $last_version) { - return $this->migrateTo($current_version, $last_version); - } - - return true; - } - - - public function migrateTo($current_version, $next_version) - { - try { - - $this->db->startTransaction(); - - for ($i = $current_version + 1; $i <= $next_version; $i++) { - - $function_name = '\Schema\version_'.$i; - - if (function_exists($function_name)) { - call_user_func($function_name, $this->db->getConnection()); - $this->db->getConnection()->setSchemaVersion($i); - } - } - - $this->db->closeTransaction(); - } - catch (\PDOException $e) { - $this->db->setLogMessage($function_name.' => '.$e->getMessage()); - $this->db->cancelTransaction(); - return false; - } - - return true; - } -}
\ No newline at end of file |