Created
March 3, 2020 02:02
-
-
Save adibenc/758bcca9cfae65d49a5fa611c20f949a to your computer and use it in GitHub Desktop.
base migrate add column
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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