This is a starter template with CodeIgniter 3.1.x and database migration & seeding tools.
- CodeIgniter Migration with CodeIgniter Command Line Interface (CLI)
- CodeIgniter Database seeding with CodeIgniter Command Line Interface (CLI)
- Faker PHP Library
- Pretty CLI commands
- Clone this repository
git clone https://github.com/aaron5670/CodeIgniter-3-Database-Migration-and-Seeding.git
- Install all required packages with Composer with your CLI:
composer install
. - Configure application/config/config.php.
- Configure application/config/database.php.
Available Command Line Interface (CLI) commands | Description |
---|---|
php index.php tools migration "file_name" | Create new migration file |
php index.php tools migrate ["version_number"] | Run all migrations. The version number is optional. |
php index.php tools seeder "file_name" | Creates a new seed file. |
php index.php tools seed "file_name" | Run the specified seed file. |
In application/database/migrations is a migrations file and in application/database/seeds is a seeder file created for this example.
Type the following commands in your CLI:
php index.php tools migrate BrandSeeder
php index.php tools migrate
php index.php tools seed BrandsSeeder
- Check your database changes :)