e...">

Change Laravel 5 table with migration

I am building an application with laravel 5. I am changing the "vote" field, which I defined as

$ table-> enum ('vote', [ '- 1 ', '0 ', '1 ']); 

and should be as follows:

 $ table-> enum ('vote', [' 1', ' 2', ' 3', ' 4', ' 5'] ) ; 
+13
migration laravel
source share
3 answers

To do this, you must follow these steps:

  1. create a new migration file

     php artisan make:migration update_votes_table 
  2. open the newly created migration file (app_folder \ database \ migrations {date_migrationfile_was_created} -update_votes_tables.php)

  3. change the columns you want to change

See the database migration documentation for more information .

Note. If you add your migration file to the question, we can provide more detailed help.

+19
source share

this is how i do it:

  php artisan make:migration Alter_votes_to_tableName --table=tableName 

open the file and change it then

 php artisan migrate 
+11
source share

first create a new migration using the command below

 php artisan make:migration Alter_your_comment_yourTableName --table=yourTableName 

modify the file according to your requirements and after that run the command below in composer

 php artisan migrate 
0
source share

All Articles