Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

rename migration in laravel

php artisan make:migration rename_table-name_column

up(){
  Schema::table('table-name', function(Blueprint $table){ 
    $table->renameColumn('old-name', 'new-name');
  }); 
}
              
down(){
  Schema::table('table-name', function(Blueprint $table) {
    $table->renameColumn('new-name', 'old-name');
  }); 
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #rename #migration #laravel
ADD COMMENT
Topic
Name
1+9 =