Created
October 27, 2018 05:06
-
-
Save awaidus/31936e63f9f85c1a2d261baf6656e843 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//step-1 create Mirgrate controller in application/controller folder | |
<?php if ( ! defined('BASEPATH')) exit("No direct script access allowed"); | |
class Migrate extends CI_Controller { | |
public function __construct() | |
{ | |
parent::__construct(); | |
$this->input->is_cli_request() | |
or exit("Execute via command line: php index.php migrate"); | |
$this->load->library('migration'); | |
} | |
public function index() | |
{ | |
if(!$this->migration->latest()) | |
{ | |
show_error($this->migration->error_string()); | |
} else { | |
echo 'Migration(s) done'.PHP_EOL; | |
} | |
} | |
} | |
//step-2: Then to execute latest migration, cd into the root of the project directory and run: | |
php index.php migrate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment