Skip to content

Instantly share code, notes, and snippets.

@leolabs
Created December 13, 2017 13:07
Show Gist options
  • Save leolabs/ca68b7a536ef350015dc2353f661aabe to your computer and use it in GitHub Desktop.
Save leolabs/ca68b7a536ef350015dc2353f661aabe to your computer and use it in GitHub Desktop.
CodeIgniter Migration Template
<?php defined('BASEPATH') OR exit('No direct script access allowed');
#set($name = ${NAME})
#set($className = $name.replaceAll("[0-9]+_", ""))
class Migration_$className extends CI_Migration {
public function __construct() {
parent::__construct();
\$this->load->dbforge();
}
public function up() {
\$sqlSteps = [
#[[$END$]]#
];
foreach (\$sqlSteps as \$step) {
if(!\$this->db->query(\$step)) return false;
}
return true;
}
public function down() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment