Empty Migrations files
Closed this issue · 1 comments
federicovilla commented
I got in trouble trying to retrieve the migrations files placed in the APPPATH migration folder.
In my Migrate controller I have:
/**
* @var array Migrations
*/
protected $migrations;
/**
* @var bool Migration Status
*/
protected $migration_enabled;
/*
* Constructor
*/
function __construct()
{
parent::__construct();
$this->config->load('migration');
$this->migration_enabled = $this->config->item('migration_enabled');
if ($this->migration_enabled && uri_string() != 'migrate/token')
{
$this->load->database();
$this->load->library('migration');
$this->migrations = $this->migration->find_migrations();
}
}
public function index()
{
if ($this->migration_enabled)
{
foreach ($this->migrations as $version => $filepath)
{
$fp = explode(DIRECTORY_SEPARATOR, $filepath);
$data['migrations'][] = [
'version' => $version,
'file' => $fp[count($fp) - 1],
];
}
$migration_db = $this->db->get($this->config->item('migration_table'))->row_array(1);
$data['current_version'] = $migration_db['version'];
}
else
{
$data['migration_disabled'] = TRUE;
}
$this->render('adm/database/migrate_view');
}
The view is the same of your script.
I get an empty table saying "No migrations", but it's not true...in the server migration folder there are two files; I have no idea why I don't get the files list.
Any hint?
Thanks
federicovilla commented
Silly me!!!....it works fine using $this->data[] instead $data[].
Sorry for posting stupid question :(