![cascading style sheets | Lava Lamp Lab cascading style sheets](https://lavalamplab.b-cdn.net/wp-content/uploads/2020/11/css.jpg)
What’s The Deal With CSS4?
November 30, 2020![how to implement a cropper tools in your frontend vue application | Lava Lamp Lab how to implement a cropper tools in your frontend vue application](https://lavalamplab.b-cdn.net/wp-content/uploads/2021/01/crop-tool-150x150.png)
How To Implement A Cropper Tool In Your Frontend Vue Application
January 11, 2021![laravel migrations vs codeIgniter migrations | Lava Lamp Lab laravel migrations vs codeIgniter migrations](https://lavalamplab.b-cdn.net/wp-content/uploads/2020/12/migration.jpg)
Laravel and CodeIgniter are both PHP frameworks. They have many differences but they also have their similarities. One of their similarities is that they both have migrations but I will be showing you the differences between their migrations.
Migration: A migration is a single PHP file that describes the changes to operate to the database. A migration file can create or drop tables, add or remove columns, create indexes and even insert data into your database.
The Setup:
Laravel:
- Type the below into your command line:
php artisan make:migration migrationName
- The naming conventions I use for the migrationName
- If I am creating a table: createUsersTable
- If I am altering a table: alterUsersTableAddContact - I usually specify what I am altering incase I need to alter the table again in the future then it is easy to keep track of changes.
CodeIgniter:
- Open application/config/migration.php and check that
$config['migration_enabled']
 is set to true. - In application/config/ create a folder called migrations
- In the migrations folder is where you can create your migrations
- Naming conventions to use for the migration file name: YYYYMMDDHHIISS_create_users
- where:
- YYYYMMDDHHIISS is the time stamp of when you are creating the file
- create_users is what the migration does (eg. creates a users table)
- where:
- Naming conventions to use for the migration file name: YYYYMMDDHHIISS_create_users
- In the migration file you created add the below code:
Creating a Migration
Laravel:
- Locate the migration file that was created (database/migrations/)
- If you are creating a table:
-
- If you are altering a table:
CodeIgniter:
- Edit your migration file you created
- If you are creating a table:
-
- If you are altering a table:
Running Migrations
Laravel:
- Type the below into your command line
php artisan migrate
migrate:fresh
 will drop all the tables you currently have in your DB and migrate all migrations from scratchmigrate:rollback
will rollback your DB to the state it was before you did your last migration
CodeIgniter:
- To run the migrations you have created you will need to create a controller called migrate
- In your migrate controller add the code below:
- To run the migrations go to http://yoursite.com/migrate Â
Conclusion
Laravel and CodeIgniter are very similar in their processes but I find Laravel's migrations a lot easier and faster to implement.
Happy Coding!