If you want to add a new index to some columns in your existing table, you can do it pretty easily with Laravel migration. First, create the migration: Then edit the migration php file. In this example, we are adding two indexes to a table, parent_id and slug:
Hello, friends. In Laravel you can check the queries which your migration will run before actually running it. This is called a “dry run”. You will have to use –pretend flag for that. See the example below: First, we create a migration: Now, let’s go and edit the migration, for example: Now we can “pretend” […]
Sometimes you need to run only one specific database migration in Laravel. You can do it with the following command.
To remove a column from a database table in Laravel, you need to create a migration, edit, and then run it in the command line interface. Create the migration You need to open your Laravel application folder in Terminal. Then run one of the following commands. Remember that you can skip typing underscore symbols, see […]