Rolling back/stepping forward with version()

You may wish to deliberately alter the database by pointing it to a specific migration number. This can be achieved by use of the version() function within CodeIgniter.

Getting ready

Ensure that you have followed the preceding recipe, Using CodeIgniter database migrations.

How to do it...

  1. Using your command line (terminal application), navigate to the root of your CodeIgniter installation (where the index.php file is) and type the following:
    php index.php migrate version 1

How it works...

Consider the following command line:

php index.php migrate version number

number is highlighted as it specifies the migration file number to move to, that is, 1, 2, 3, and so on.

The first thing we should bear in mind is ...

Get CodeIgniter 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.