Skip to content

Instantly share code, notes, and snippets.

@adibenc
Created March 3, 2020 02:02
Show Gist options
  • Save adibenc/758bcca9cfae65d49a5fa611c20f949a to your computer and use it in GitHub Desktop.
Save adibenc/758bcca9cfae65d49a5fa611c20f949a to your computer and use it in GitHub Desktop.
base migrate add column
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterAddIdSekolah extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//add id sekolah
Schema::table('siswa', function (Blueprint $table) {
$table->integer('id_sekolah')->after('id_siswa')->default(1)->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::table('siswa', function (Blueprint $table) {
$table->dropColumn('id_sekolah');
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment