diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-02-15 22:26:16 +0100 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-02-15 22:26:16 +0100 |
commit | d98325db8019d7ed71906d63442c694da038fcf7 (patch) | |
tree | ca03aff84e95efc5cf69776c22772f82dd060806 /application/controllers/migrate.php | |
parent | ff1cfa1ae5c5440bfde35c36ecb4cdcd73cd3966 (diff) | |
parent | 17d184dad3a5b28f209e346e53d9956988e0c4a3 (diff) |
Automated merge with https://bitbucket.org/seandowney/codeigniter-reactor
Diffstat (limited to 'application/controllers/migrate.php')
-rw-r--r-- | application/controllers/migrate.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/application/controllers/migrate.php b/application/controllers/migrate.php new file mode 100644 index 000000000..e5442e79c --- /dev/null +++ b/application/controllers/migrate.php @@ -0,0 +1,40 @@ +<?php +class Migrate extends CI_Controller +{ + function __construct() + { + parent::__construct(); + + $this->load->library('migration'); + + /** VERY IMPORTANT - only turn this on when you need it. */ +// show_error('Access to this controller is blocked, turn me on when you need me.'); + } + + // Install up to the most up-to-date version. + function install() + { + if ( ! $this->migration->current()) + { + show_error($this->migration->error); + exit; + } + + echo "<br />Migration Successful<br />"; + } + + // This will migrate up to the configed migration version + function version($id = NULL) + { + // No $id supplied? Use the config version + $id OR $id = $this->config->item('migration_version'); + + if ( ! $this->migration->version($id)) + { + show_error($this->migration->error); + exit; + } + + echo "<br />Migration Successful<br />"; + } +} |