Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Laravel 5 Migration

    • 0
    • 2
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.15k
    Comment on it

    Migrations play a very important role in any MVC Framework. They work as a version control for your database. By using Migrations we can update the database schema and stay up to date on the current schema. By using Migration we can easily manage our schema.

    Migrations Creation:
    In laravel5 Migrations can be create using the following command.

    Command:

    `php artisan make:migration createUserTableName`
    

    when you type this command and see the folder app/database/migrations. Here we can see our migration table has been created according to the timestamp. If we want to indicate our table name then by using --table and --create we can indicate the name of the table.

    Command:

    php artisan make:migration tableName --table=users
    php artisan make:migration tableName  --create=users
    

    Running Migrations:
    Running all migration file we use the command.


    Command:

    php artisan migrate
    

    Forcing Migrations In Production:
    There are are some command which we have to run very carefully because they may cause to lose the data.For block those command we will use this command.

    Command:

    `php artisan migrate --force`
    

    Rolling Back Migrations:
    To roll back the last migration operation we will use the command.

    Command:

    `php artisan migrate:rollback`
    

    and to roll back whole migration command we will use

    php artisan migrate:reset
    

    These all command we use for migration in laravel 5.x

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: