I know how to create them via http://codeigniter.com/user_guide/libraries/migration.html
But once I've created my migration files, how do I run them?
I know how to create them via http://codeigniter.com/user_guide/libraries/migration.html
But once I've created my migration files, how do I run them?
https://github.com/AimalAzmi/codeigniter-migrations
Try this, I've written a library for this which can be used very easily through the CLI. It can be used to create migrations files and run migrations backwards or forwards.
You can also run some version for down or up migrations:
For CLI run this command
php index.php migrate version 5
, where5
is version of migration. If version is more of current migration - migration up, else - down to entered version.This is simplest Codeigniter Database Migrations
`.
$config['migration_enabled'] = TRUE;
.php index.php migrate
I am not sure this is the right way to do it, But It works for me.
I created a controller named
migrate
(controllers/migrate.php).Then from browser I will call this url to execute
index
action inmigrate
controllerEg : http://localhost/index.php/migrate/index/1
Using these pages as references: Running via the CLI and Migration Class you're able to restrict access to your migration controller to command line with something along these lines (application/controllers/migrate.php):
then to execute your latest migration, cd into the root of your project directory and run:
but when you attempt to access via webserver domain.com/migrate you will see the text in the script above.