forked from petanikode/tutorial-codeigniter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMigrate.php
More file actions
44 lines (31 loc) · 755 Bytes
/
Copy pathMigrate.php
File metadata and controls
44 lines (31 loc) · 755 Bytes
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
<?php
class Migrate extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->library('migration');
}
public function index()
{
if (!is_cli()) {
return show_error("Not Allowed", 403, "Error 403 Forbidden");
}
$migrate = $this->migration->latest();
if ($migrate === FALSE) {
show_error($this->migration->error_string());
}
echo "Migrate to version: " . $migrate;
}
public function rollback($version = null)
{
if (!is_cli()) {
return show_error("Not Allowed", 403, "Error 403 Forbidden");
}
$rollback = $this->migration->version($version);
if ($rollback === FALSE) {
show_error($this->migration->error_string());
}
echo "Rollback to version: " . $rollback;
}
}