Welcome Guest, Not a member yet? Register   Sign In
Migrations can't be rolled back
#1

(This post was last modified: 08-26-2017, 07:01 AM by Wouter60.)

I'm trying to set up a controller for running migrations, and - if necessary - rolling them back.

In the migrations config I have these settings:
PHP Code:
$config['migration_enabled'] = TRUE;
$config['migration_type'] = 'timestamp';
$config['migration_table'] = 'migrations';
$config['migration_auto_latest'] = FALSE;
$config['migration_version'] = '20170826141700' //this is the first migration I need to run
$config['migration_path'] = APPPATH.'migrations/'

I have a file named "20170826141700_create_eventlog_table.php" in application/migrations.
This file has a class named "Migration_Create_eventlog_table" with 2 functions: up() and down().
The up function creates a table ('eventlog') in my database.
The down function drops this table.

If I run $this->migration->latest(), it returns TRUE.
The eventlog table is created succesfully. So far, so good.

However, the migrations table remains empty. The version number of the latest migration isn't saved.
As a result of this, I can't rollback this migration.
How can I get this working?
Reply


Messages In This Thread
Migrations can't be rolled back - by Wouter60 - 08-26-2017, 06:48 AM
RE: Migrations can't be rolled back - by Wouter60 - 08-26-2017, 07:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB