Skip to content

Commit cbc86c8

Browse files
author
Phil Sturgeon
committed
Tidies up README and removed the system.php, that file is just going to confuse people.
1 parent c374f45 commit cbc86c8

File tree

2 files changed

+17
-97
lines changed

2 files changed

+17
-97
lines changed

README.textile

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,51 +33,42 @@ h3. Install
3333

3434
Copy the files to these locations.
3535

36-
config/migration.php -> application/config/
37-
libraries/Migration.php -> application/libraries/
38-
controllers/dbmigrate.php -> applcation/controllers/
36+
config/migrations.php -> application/config/
37+
libraries/Migrations.php -> application/libraries/
38+
controllers/migrate.php -> applcation/controllers/
3939

4040
The migration files included in this are just examples. You should install them where ever you
4141
point your $config["migrations_path"] to.
4242

4343
h3. Usage
4444

45-
$this->load->library('migrate');
46-
$this->migration->set_verbose(TRUE); // echo statments or not
47-
$this->migration->version(id); // migrate the database to a particular version
48-
$this->migration->install(); // install to the latest version.
49-
50-
The dbmigreate.php controller just shows the use of these functions. If you are going to use it.
51-
remove the 'die();' and put it back in place when you are done.
52-
53-
-** THE KICKER **-
54-
-At the bottom of migreate.php we assume you are keeping track of your versions with a db table called config. Yes you can not use this migration script to create that table. You need at least one table installed to boot strap this. You will want to review the _update_schema_version() function to either modify or copy how it works.-
55-
56-
-Also, in our applcations we have this code to set our applcation configs. We do not believe in writting to the file system that is what a database is for :).-
45+
$this->load->library('migrations');
46+
$this->migrations->set_verbose(TRUE); // echo statments or not
47+
$this->migrations->version(id); // migrate the database to a particular version
48+
$this->migrations->install(); // install to the latest version.
5749

50+
The migreate.php controller just shows the use of these functions. If you are going to use it.
51+
comment out the show_error() in the construct, and put it back in place when you are done.
52+
5853
-System configury code gone-
5954

60-
-In this code we set. $this->CI->config->item('migration_version'); and that is how _get_schema_version()
55+
-In this code we set. $this->config->item('migration_version'); and that is how _get_schema_version()
6156
gets the current version. This is the version this database is set too.-
6257

63-
** Suggestion **
64-
We also do this on login to make sure this database is migrated to the version the config files wants it to be migrated too.
65-
6658
// Make sure our database is up-to-date
67-
$this->migration->set_verbose(FALSE);
68-
if(! $this->migration->version($this->config->item('migrations_version')))
59+
if ( ! $this->migration->version($this->config->item('migrations_version')))
60+
{
6961
show_error($this->migration->error);
70-
62+
}
7163

7264
Over all you should read this and http://codeigniter.com/wiki/Migrations to get an over all feel for this and make any changes
7365
you need for your applcation.
74-
7566

7667
Other Helpful Stuff:
7768

78-
Included in this git repo is an example system.php file. A way to have migrations run on every page load. You can copy it directly or use it as an example for your own code structure.
79-
80-
When you auto load the system.php lib this should be your order: $autoload['libraries'] = array('database', 'migrate', 'system', 'session');
69+
Included in this git repo is an example CodeIgniter Hook and a basic config/hooks.php to show
70+
how to enable it. This hook is one of several ways to have migrations run on every page load. You
71+
could also place the code into a MY_Controller.
8172

8273
Here is a video walk through of migrations in action.
8374

system.php

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)