Skip to content

Instantly share code, notes, and snippets.

@chihirokaasan
Created March 25, 2017 02:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chihirokaasan/22b6758e366d78f7cbaca12ddd4e21e9 to your computer and use it in GitHub Desktop.
Save chihirokaasan/22b6758e366d78f7cbaca12ddd4e21e9 to your computer and use it in GitHub Desktop.
migrationfile zerofill
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddZerofill extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('table_name', function(Blueprint $table)
{
$sql = 'ALTER TABLE table_name ADD column_name INT ZEROFILL';
DB::statement($sql);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('table_name', function(Blueprint $table)
{
//
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment