1. Home
  2. Docs
  3. laravel
  4. “php artisan make:&...
  5. artisan make:migration

artisan make:migration

PURPOSE

  • A ‘migration’ is any change in the database layout
  • It can be creating a new table, removing/dropping a table or modifying the layout of an existing database table.

USAGE

>php artisan make:migration create_widgets_table
>php artisan make:migration alter_widgets_table
>php artisan make:migration drop_widgets_table
 
 Description:
   Create a new migration file

 Usage:
   make:migration [options] [--] <name>

 Arguments:
   name                   The name of the migration

 Options:
       --create[=CREATE]  The table to be created
       --table[=TABLE]    The table to migrate
       --path[=PATH]      The location where the migration file should be created
       --realpath         Indicate any provided migration file paths are pre-resolved absolute paths
       --fullpath         Output the full path of the migration
   -h, --help             Display this help message
   -q, --quiet            Do not output any message
   -V, --version          Display this application version
       --ansi             Force ANSI output
       --no-ansi          Disable ANSI output
   -n, --no-interaction   Do not ask any interactive question
       --env[=ENV]        The environment the command should run under
   -v|vv|vvv, --verbose   Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug 

PARAMETERS

--create=Widget

The table to be created.

--table=Widget

The table to migrate.

--path=Path

The location where the migration file should be created.

--realpath

Indicate any provided migration file paths are pre-resolved absolute path.

--fullpath

Output the full path of the migration.

OUTPUT

Output will be in app/database/migrations/:
app/database/migrations/[day]_[time]_create_widgets_table.php

Reference: https://laravel.com/docs/6.x/migrations

Tags , , ,