Andrey Andreev | dd4702f | 2011-12-24 19:33:44 +0200 | [diff] [blame] | 1 | <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 2 | /** |
| 3 | * CodeIgniter |
| 4 | * |
| 5 | * An open source application development framework for PHP 5.1.6 or newer |
| 6 | * |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 7 | * NOTICE OF LICENSE |
Eric Barnes | dd81c43 | 2011-11-16 11:07:35 -0500 | [diff] [blame] | 8 | * |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 9 | * Licensed under the Open Software License version 3.0 |
Eric Barnes | dd81c43 | 2011-11-16 11:07:35 -0500 | [diff] [blame] | 10 | * |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 11 | * This source file is subject to the Open Software License (OSL 3.0) that is |
| 12 | * bundled with this package in the files license.txt / license.rst. It is |
| 13 | * also available through the world wide web at this URL: |
| 14 | * http://opensource.org/licenses/OSL-3.0 |
| 15 | * If you did not receive a copy of the license and are unable to obtain it |
| 16 | * through the world wide web, please send an email to |
| 17 | * licensing@ellislab.com so we can send you a copy immediately. |
| 18 | * |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 19 | * @package CodeIgniter |
| 20 | * @author EllisLab Dev Team |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 21 | * @copyright Copyright (c) 2006 - 2011, EllisLab, Inc. (http://ellislab.com/) |
| 22 | * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 23 | * @link http://codeigniter.com |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 24 | * @since Version 3.0 |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 25 | * @filesource |
| 26 | */ |
| 27 | |
| 28 | // ------------------------------------------------------------------------ |
| 29 | |
| 30 | /** |
| 31 | * Migration Class |
| 32 | * |
| 33 | * All migrations should implement this, forces up() and down() and gives |
| 34 | * access to the CI super-global. |
| 35 | * |
| 36 | * @package CodeIgniter |
| 37 | * @subpackage Libraries |
| 38 | * @category Libraries |
| 39 | * @author Reactor Engineers |
| 40 | * @link |
| 41 | */ |
| 42 | class CI_Migration { |
| 43 | |
Phil Sturgeon | 96bd33b | 2011-05-04 01:30:36 +0100 | [diff] [blame] | 44 | protected $_migration_enabled = FALSE; |
| 45 | protected $_migration_path = NULL; |
| 46 | protected $_migration_version = 0; |
Cloudmanic Labs, LLC | 539dcb0 | 2011-09-18 12:08:56 -0700 | [diff] [blame] | 47 | protected $_migration_table = 'migrations'; |
Cloudmanic Labs, LLC | d1ba8f7 | 2011-09-18 12:23:00 -0700 | [diff] [blame] | 48 | protected $_migration_auto_latest = FALSE; |
Eric Barnes | dd81c43 | 2011-11-16 11:07:35 -0500 | [diff] [blame] | 49 | |
Phil Sturgeon | cb06c65 | 2011-05-04 10:50:25 +0100 | [diff] [blame] | 50 | protected $_error_string = ''; |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 51 | |
Phil Sturgeon | 96bd33b | 2011-05-04 01:30:36 +0100 | [diff] [blame] | 52 | public function __construct($config = array()) |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 53 | { |
| 54 | # Only run this constructor on main library load |
| 55 | if (get_parent_class($this) !== FALSE) |
| 56 | { |
| 57 | return; |
| 58 | } |
| 59 | |
| 60 | foreach ($config as $key => $val) |
| 61 | { |
| 62 | $this->{'_' . $key} = $val; |
| 63 | } |
| 64 | |
| 65 | log_message('debug', 'Migrations class initialized'); |
| 66 | |
| 67 | // Are they trying to use migrations while it is disabled? |
| 68 | if ($this->_migration_enabled !== TRUE) |
| 69 | { |
| 70 | show_error('Migrations has been loaded but is disabled or set up incorrectly.'); |
| 71 | } |
| 72 | |
| 73 | // If not set, set it |
Eric Barnes | dd81c43 | 2011-11-16 11:07:35 -0500 | [diff] [blame] | 74 | $this->_migration_path == '' AND $this->_migration_path = APPPATH.'migrations/'; |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 75 | |
| 76 | // Add trailing slash if not set |
| 77 | $this->_migration_path = rtrim($this->_migration_path, '/').'/'; |
| 78 | |
Phil Sturgeon | 96bd33b | 2011-05-04 01:30:36 +0100 | [diff] [blame] | 79 | // Load migration language |
| 80 | $this->lang->load('migration'); |
| 81 | |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 82 | // They'll probably be using dbforge |
| 83 | $this->load->dbforge(); |
| 84 | |
Cloudmanic Labs, LLC | 539dcb0 | 2011-09-18 12:08:56 -0700 | [diff] [blame] | 85 | // Make sure the migration table name was set. |
Cloudmanic Labs, LLC | 63b61e3 | 2011-09-19 09:35:05 -0700 | [diff] [blame] | 86 | if (empty($this->_migration_table)) |
Cloudmanic Labs, LLC | 539dcb0 | 2011-09-18 12:08:56 -0700 | [diff] [blame] | 87 | { |
Eric Barnes | dd81c43 | 2011-11-16 11:07:35 -0500 | [diff] [blame] | 88 | show_error('Migrations configuration file (migration.php) must have "migration_table" set.'); |
Cloudmanic Labs, LLC | 539dcb0 | 2011-09-18 12:08:56 -0700 | [diff] [blame] | 89 | } |
| 90 | |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 91 | // If the migrations table is missing, make it |
Cloudmanic Labs, LLC | 539dcb0 | 2011-09-18 12:08:56 -0700 | [diff] [blame] | 92 | if ( ! $this->db->table_exists($this->_migration_table)) |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 93 | { |
| 94 | $this->dbforge->add_field(array( |
| 95 | 'version' => array('type' => 'INT', 'constraint' => 3), |
| 96 | )); |
| 97 | |
Cloudmanic Labs, LLC | 539dcb0 | 2011-09-18 12:08:56 -0700 | [diff] [blame] | 98 | $this->dbforge->create_table($this->_migration_table, TRUE); |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 99 | |
Cloudmanic Labs, LLC | 539dcb0 | 2011-09-18 12:08:56 -0700 | [diff] [blame] | 100 | $this->db->insert($this->_migration_table, array('version' => 0)); |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 101 | } |
Eric Barnes | dd81c43 | 2011-11-16 11:07:35 -0500 | [diff] [blame] | 102 | |
Cloudmanic Labs, LLC | d1ba8f7 | 2011-09-18 12:23:00 -0700 | [diff] [blame] | 103 | // Do we auto migrate to the latest migration? |
Andrey Andreev | dd4702f | 2011-12-24 19:33:44 +0200 | [diff] [blame] | 104 | if ($this->_migration_auto_latest === TRUE AND ! $this->latest()) |
Cloudmanic Labs, LLC | d1ba8f7 | 2011-09-18 12:23:00 -0700 | [diff] [blame] | 105 | { |
Andrey Andreev | dd4702f | 2011-12-24 19:33:44 +0200 | [diff] [blame] | 106 | show_error($this->error_string()); |
Cloudmanic Labs, LLC | d1ba8f7 | 2011-09-18 12:23:00 -0700 | [diff] [blame] | 107 | } |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 108 | } |
| 109 | |
| 110 | // -------------------------------------------------------------------- |
| 111 | |
| 112 | /** |
| 113 | * Migrate to a schema version |
| 114 | * |
| 115 | * Calls each migration step required to get to the schema version of |
| 116 | * choice |
| 117 | * |
| 118 | * @access public |
| 119 | * @param $version integer Target schema version |
| 120 | * @return mixed TRUE if already latest, FALSE if failed, int if upgraded |
| 121 | */ |
Phil Sturgeon | 96bd33b | 2011-05-04 01:30:36 +0100 | [diff] [blame] | 122 | public function version($target_version) |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 123 | { |
| 124 | $start = $current_version = $this->_get_version(); |
| 125 | $stop = $target_version; |
| 126 | |
| 127 | if ($target_version > $current_version) |
| 128 | { |
| 129 | // Moving Up |
| 130 | ++$start; |
| 131 | ++$stop; |
| 132 | $step = 1; |
| 133 | } |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 134 | else |
| 135 | { |
| 136 | // Moving Down |
| 137 | $step = -1; |
| 138 | } |
Eric Barnes | dd81c43 | 2011-11-16 11:07:35 -0500 | [diff] [blame] | 139 | |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 140 | $method = $step === 1 ? 'up' : 'down'; |
| 141 | $migrations = array(); |
| 142 | |
| 143 | // We now prepare to actually DO the migrations |
| 144 | // But first let's make sure that everything is the way it should be |
| 145 | for ($i = $start; $i != $stop; $i += $step) |
| 146 | { |
Eric Barnes | dd81c43 | 2011-11-16 11:07:35 -0500 | [diff] [blame] | 147 | $f = glob(sprintf($this->_migration_path.'%03d_*.php', $i)); |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 148 | |
| 149 | // Only one migration per step is permitted |
| 150 | if (count($f) > 1) |
| 151 | { |
Phil Sturgeon | cb06c65 | 2011-05-04 10:50:25 +0100 | [diff] [blame] | 152 | $this->_error_string = sprintf($this->lang->line('migration_multiple_version'), $i); |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 153 | return FALSE; |
| 154 | } |
| 155 | |
| 156 | // Migration step not found |
Andrey Andreev | dd4702f | 2011-12-24 19:33:44 +0200 | [diff] [blame] | 157 | if (count($f) === 0) |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 158 | { |
| 159 | // If trying to migrate up to a version greater than the last |
| 160 | // existing one, migrate to the last one. |
Andrey Andreev | dd4702f | 2011-12-24 19:33:44 +0200 | [diff] [blame] | 161 | if ($step === 1) |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 162 | { |
| 163 | break; |
| 164 | } |
| 165 | |
| 166 | // If trying to migrate down but we're missing a step, |
| 167 | // something must definitely be wrong. |
Phil Sturgeon | cb06c65 | 2011-05-04 10:50:25 +0100 | [diff] [blame] | 168 | $this->_error_string = sprintf($this->lang->line('migration_not_found'), $i); |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 169 | return FALSE; |
| 170 | } |
| 171 | |
| 172 | $file = basename($f[0]); |
| 173 | $name = basename($f[0], '.php'); |
| 174 | |
| 175 | // Filename validations |
| 176 | if (preg_match('/^\d{3}_(\w+)$/', $name, $match)) |
| 177 | { |
| 178 | $match[1] = strtolower($match[1]); |
| 179 | |
| 180 | // Cannot repeat a migration at different steps |
| 181 | if (in_array($match[1], $migrations)) |
| 182 | { |
Phil Sturgeon | cb06c65 | 2011-05-04 10:50:25 +0100 | [diff] [blame] | 183 | $this->_error_string = sprintf($this->lang->line('migration_multiple_version'), $match[1]); |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 184 | return FALSE; |
| 185 | } |
| 186 | |
| 187 | include $f[0]; |
Eric Barnes | dd81c43 | 2011-11-16 11:07:35 -0500 | [diff] [blame] | 188 | $class = 'Migration_'.ucfirst($match[1]); |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 189 | |
| 190 | if ( ! class_exists($class)) |
| 191 | { |
Phil Sturgeon | cb06c65 | 2011-05-04 10:50:25 +0100 | [diff] [blame] | 192 | $this->_error_string = sprintf($this->lang->line('migration_class_doesnt_exist'), $class); |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 193 | return FALSE; |
| 194 | } |
| 195 | |
Phil Sturgeon | 96bd33b | 2011-05-04 01:30:36 +0100 | [diff] [blame] | 196 | if ( ! is_callable(array($class, $method))) |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 197 | { |
Phil Sturgeon | cb06c65 | 2011-05-04 10:50:25 +0100 | [diff] [blame] | 198 | $this->_error_string = sprintf($this->lang->line('migration_missing_'.$method.'_method'), $class); |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 199 | return FALSE; |
| 200 | } |
| 201 | |
| 202 | $migrations[] = $match[1]; |
| 203 | } |
| 204 | else |
| 205 | { |
Phil Sturgeon | cb06c65 | 2011-05-04 10:50:25 +0100 | [diff] [blame] | 206 | $this->_error_string = sprintf($this->lang->line('migration_invalid_filename'), $file); |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 207 | return FALSE; |
| 208 | } |
| 209 | } |
| 210 | |
Eric Barnes | dd81c43 | 2011-11-16 11:07:35 -0500 | [diff] [blame] | 211 | log_message('debug', 'Current migration: '.$current_version); |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 212 | |
Andrey Andreev | dd4702f | 2011-12-24 19:33:44 +0200 | [diff] [blame] | 213 | $version = $i + ($step === 1 ? -1 : 0); |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 214 | |
| 215 | // If there is nothing to do so quit |
| 216 | if ($migrations === array()) |
| 217 | { |
| 218 | return TRUE; |
| 219 | } |
| 220 | |
Eric Barnes | dd81c43 | 2011-11-16 11:07:35 -0500 | [diff] [blame] | 221 | log_message('debug', 'Migrating from '.$method.' to version '.$version); |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 222 | |
| 223 | // Loop through the migrations |
| 224 | foreach ($migrations AS $migration) |
| 225 | { |
| 226 | // Run the migration class |
Eric Barnes | dd81c43 | 2011-11-16 11:07:35 -0500 | [diff] [blame] | 227 | $class = 'Migration_'.ucfirst(strtolower($migration)); |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 228 | call_user_func(array(new $class, $method)); |
| 229 | |
| 230 | $current_version += $step; |
| 231 | $this->_update_version($current_version); |
| 232 | } |
| 233 | |
Phil Sturgeon | 96bd33b | 2011-05-04 01:30:36 +0100 | [diff] [blame] | 234 | log_message('debug', 'Finished migrating to '.$current_version); |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 235 | |
| 236 | return $current_version; |
| 237 | } |
| 238 | |
| 239 | // -------------------------------------------------------------------- |
| 240 | |
| 241 | /** |
| 242 | * Set's the schema to the latest migration |
| 243 | * |
| 244 | * @access public |
| 245 | * @return mixed true if already latest, false if failed, int if upgraded |
| 246 | */ |
| 247 | public function latest() |
| 248 | { |
| 249 | if ( ! $migrations = $this->find_migrations()) |
| 250 | { |
Cloudmanic Labs, LLC | 3d036e3 | 2011-11-11 22:46:21 -0800 | [diff] [blame] | 251 | $this->_error_string = $this->lang->line('migration_none_found'); |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 252 | return false; |
| 253 | } |
| 254 | |
| 255 | $last_migration = basename(end($migrations)); |
Eric Barnes | dd81c43 | 2011-11-16 11:07:35 -0500 | [diff] [blame] | 256 | |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 257 | // Calculate the last migration step from existing migration |
| 258 | // filenames and procceed to the standard version migration |
Phil Sturgeon | 96bd33b | 2011-05-04 01:30:36 +0100 | [diff] [blame] | 259 | return $this->version((int) substr($last_migration, 0, 3)); |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 260 | } |
| 261 | |
| 262 | // -------------------------------------------------------------------- |
| 263 | |
| 264 | /** |
| 265 | * Set's the schema to the migration version set in config |
| 266 | * |
| 267 | * @access public |
| 268 | * @return mixed true if already current, false if failed, int if upgraded |
| 269 | */ |
| 270 | public function current() |
| 271 | { |
Phil Sturgeon | 96bd33b | 2011-05-04 01:30:36 +0100 | [diff] [blame] | 272 | return $this->version($this->_migration_version); |
| 273 | } |
| 274 | |
| 275 | // -------------------------------------------------------------------- |
| 276 | |
| 277 | /** |
| 278 | * Error string |
| 279 | * |
| 280 | * @access public |
| 281 | * @return string Error message returned as a string |
| 282 | */ |
| 283 | public function error_string() |
| 284 | { |
Phil Sturgeon | cb06c65 | 2011-05-04 10:50:25 +0100 | [diff] [blame] | 285 | return $this->_error_string; |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 286 | } |
| 287 | |
| 288 | // -------------------------------------------------------------------- |
| 289 | |
| 290 | /** |
| 291 | * Set's the schema to the latest migration |
| 292 | * |
Phil Sturgeon | 96bd33b | 2011-05-04 01:30:36 +0100 | [diff] [blame] | 293 | * @access protected |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 294 | * @return mixed true if already latest, false if failed, int if upgraded |
| 295 | */ |
Phil Sturgeon | 96bd33b | 2011-05-04 01:30:36 +0100 | [diff] [blame] | 296 | protected function find_migrations() |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 297 | { |
| 298 | // Load all *_*.php files in the migrations path |
Eric Barnes | dd81c43 | 2011-11-16 11:07:35 -0500 | [diff] [blame] | 299 | $files = glob($this->_migration_path.'*_*.php'); |
Eric Barnes | dd81c43 | 2011-11-16 11:07:35 -0500 | [diff] [blame] | 300 | |
Andrey Andreev | dd4702f | 2011-12-24 19:33:44 +0200 | [diff] [blame] | 301 | for ($i = 0, $c = count($files); $i < $c; $i++) |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 302 | { |
| 303 | // Mark wrongly formatted files as false for later filtering |
Andrey Andreev | dd4702f | 2011-12-24 19:33:44 +0200 | [diff] [blame] | 304 | if ( ! preg_match('/^\d{3}_(\w+)$/', basename($files[$i], '.php'))) |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 305 | { |
| 306 | $files[$i] = FALSE; |
| 307 | } |
| 308 | } |
Eric Barnes | dd81c43 | 2011-11-16 11:07:35 -0500 | [diff] [blame] | 309 | |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 310 | sort($files); |
| 311 | |
| 312 | return $files; |
| 313 | } |
| 314 | |
| 315 | // -------------------------------------------------------------------- |
| 316 | |
| 317 | /** |
| 318 | * Retrieves current schema version |
| 319 | * |
Phil Sturgeon | 96bd33b | 2011-05-04 01:30:36 +0100 | [diff] [blame] | 320 | * @access protected |
| 321 | * @return integer Current Migration |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 322 | */ |
Phil Sturgeon | 96bd33b | 2011-05-04 01:30:36 +0100 | [diff] [blame] | 323 | protected function _get_version() |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 324 | { |
Phil Sturgeon | d268eda | 2011-12-31 16:20:11 +0000 | [diff] [blame^] | 325 | $row = $this->db->select('version')->get($this->_migration_table)->row(); |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 326 | return $row ? $row->version : 0; |
| 327 | } |
| 328 | |
| 329 | // -------------------------------------------------------------------- |
| 330 | |
| 331 | /** |
| 332 | * Stores the current schema version |
| 333 | * |
Phil Sturgeon | 96bd33b | 2011-05-04 01:30:36 +0100 | [diff] [blame] | 334 | * @access protected |
| 335 | * @param $migrations integer Migration reached |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 336 | * @return void Outputs a report of the migration |
| 337 | */ |
Phil Sturgeon | 96bd33b | 2011-05-04 01:30:36 +0100 | [diff] [blame] | 338 | protected function _update_version($migrations) |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 339 | { |
Cloudmanic Labs, LLC | 539dcb0 | 2011-09-18 12:08:56 -0700 | [diff] [blame] | 340 | return $this->db->update($this->_migration_table, array( |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 341 | 'version' => $migrations |
| 342 | )); |
| 343 | } |
| 344 | |
| 345 | // -------------------------------------------------------------------- |
| 346 | |
| 347 | /** |
Phil Sturgeon | 9758d84 | 2011-02-07 20:39:00 +0000 | [diff] [blame] | 348 | * Enable the use of CI super-global |
| 349 | * |
| 350 | * @access public |
| 351 | * @param $var |
| 352 | * @return mixed |
| 353 | */ |
| 354 | public function __get($var) |
| 355 | { |
| 356 | return get_instance()->$var; |
| 357 | } |
Phil Sturgeon | 96bd33b | 2011-05-04 01:30:36 +0100 | [diff] [blame] | 358 | } |
| 359 | |
| 360 | /* End of file Migration.php */ |
Andrey Andreev | dd4702f | 2011-12-24 19:33:44 +0200 | [diff] [blame] | 361 | /* Location: ./system/libraries/Migration.php */ |