Laravel Migration - How to Add New Column in Existing Table ? (ok)
https://www.itsolutionstuff.com/post/how-to-add-new-column-in-existing-table-in-laravel-migrationexample.html
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePostsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up() {
Schema::create('posts', function (Blueprint $table) {
$table->id();
$table->string('title');
$table->text('body');
$table->boolean('is_publish')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down() {
Schema::dropIfExists('posts');
}
}
Laravel Migration - How to Add New Column in Existing Table ?
PreviousHow to Change Table Name using Laravel Migration? (ok)NextHow to Add Foreign Key in Laravel Migration? (ok)
Last updated