Add New Column Seeder

Submitted by faizalpribadi - 9 years ago

Add New Colum To Exist Table With Seeder

class AddColumnSeeder extends Seeder
{
    public function run()
    {
        DB::table('test')->delete();

        Schema::table('test', function(\Illuminate\Database\Schema\Blueprint $table) {
            $table->string('add')->after('exist_column_name');
            $table->boolean('confirmed')->default(0);
        });
    }
}

class DatabaseSeeder extends Seeder {

    /**
	 * Run the database seeds.
	 *
	 * @return void
	 */
	public function run()
	{
		Eloquent::unguard();

		// $this->call('UserTableSeeder');
		$this->call('AddColumnSeeder');
	}

}

# artisan db:seed