CodeIgniter Forums

Full Version: Migration Issues
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

I don't believe I'm doing anything wrong here (hopefully not!), but any pointers massively appreciated.

Firstly, I have migrations set up to timestamp, and have auto_latest set to true. Migrating up a version works perfectly fine. However, migrating down a version does not - nothing changes, not even the version number in the database.

For reference, this is my migration.php file in the config folder:
PHP Code:
<?php
defined
('BASEPATH') OR exit('No direct script access allowed');

$config['migration_enabled'] = TRUE;
$config['migration_type'] = 'timestamp';
$config['migration_table'] = 'Migration';
$config['migration_auto_latest'] = TRUE;
$config['migration_version'] = 20160726190300;
$config['migration_path'] = APPPATH.'migrations/'

And my log file states:
Code:
DEBUG - 2016-08-09 19:30:05 --> Finished migrating to 20160809185000

I'm not sure if it's related, but my migrations table seems to keep getting bigger and bigger, with multiple rows of the same value appearing over and over (currently 105 rows, but a new one is created each time I refresh a page of my site).

I'm running XAMPP on Windows 10. PHP 5.6.21, with MariaDB.

As I said, any pointers would be great because my table just seems to keep growing!

[Edit - 10/08/2016]
I've been looking over the Migration.php code in the /system folder (v3.0.6) to see if I can figure any of this out. It appears to be down to casing.

My table (in the config file above) is called 'Migration', but MariaDB seems to store this as 'migration', which is causing the line 167 to return true, and then go on to insert a new row:
PHP Code:
if ( ! $this->db->table_exists($this->_migration_table)) 
I tried adding a few lines to the code, as follows:
PHP Code:
echo 'DEBUG:<br>
Table Name: '
.$this->_migration_table.'<br>
Exist check: '
;
var_dump(!$this->db->table_exists($this->_migration_table)); 

Which gives me the following:
Quote:DEBUG:
Table Name: Migration
Exist check: bool(true)

But the table does 100% exist, and is in the array from the list_tables() DB call, except stored as 'migration' with a lowercase 'm'