CodeIgniter 3 with Database Migration & Seeding
About
This is a starter template with CodeIgniter 3.1.x and database migration & seeding tools.
Features
- CodeIgniter Migration with CodeIgniter Command Line Interface (CLI)
- CodeIgniter Database seeding with CodeIgniter Command Line Interface (CLI)
- Faker PHP Library
ToDo
- Pretty CLI commands
Installation
- 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.
CLI Commands
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. |
Example
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:
1. php index.php tools migrate BrandSeeder
2. php index.php tools migrate
3. php index.php tools seed BrandsSeeder
4. Check your database changes :)
Project details 3 3
View on GitHub