summaryrefslogtreecommitdiffstats
path: root/application/controllers/migrate.php
blob: e5442e79cf0f1652cf5f34f8607f08a3477858e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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 />";
	}
}