forked from cloudmanic/codeigniter-migrations
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdbmigrate.php
56 lines (51 loc) · 1.04 KB
/
dbmigrate.php
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
class Dbmigrate extends Controller {
//
// Constructor.
//
function Dbmigrate()
{
parent::Controller();
$this->load->library('migrate');
$this->config->load('migrate');
$this->migrate->setverbose(TRUE);
/**
/** VERY IMPORTANT - only turn this on when you need it.
/**
*/
die();
}
//
// This will migrate up to the configed migration version
//
function configversion()
{
if(! $this->migrate->version($this->config->item('migrations_version')))
show_error($this->migrate->error);
else
echo "<br />Migration Successful<br />";
}
//
// Install up to the most up-to-date version.
//
function install()
{
if(! $this->migrate->install())
show_error($this->migrate->error);
else
echo "<br />Migration Successful<br />";
}
//
// Migrate to a particular version.
//
function version($id = NULL)
{
if(is_null($id))
show_error("Must pass in an id.");
if(! $this->migrate->version($id))
show_error($this->migrate->error);
else
echo "<br />Migration Successful<br />";
}
}
?>