0

I am trying to extend the user's table to add more fields to it and i have this as my code in the php file in the updates folder.

<?php namespace Corymillz\Store\Updates;

use Schema;
use October\Rain\Database\Updates\Migration;

class AddNewFeilds extends Migration
{

    public function up()
    {
        Schema::table('users', function($table)
        {
            $table->string('store_title')->nullable();
            $table->text('store_description')->nullable();
            $table->string('background_color')->nullable();
            $table->string('font_color')->nullable();
            $table->string('font_family')->nullable();
            $table->dateTime('last_seen')->nullable();
        });
    }
    public function down()
    {
        $table->dropDown([

            'store_title',
            'store_description',
            'background_color',
            'font_color',
            'font_family',
            'last_seen'
        ]);
    }
}

When I run the refresh command in console php artisan plugin:refresh Corymillz.Store I keep getting the error

undefined variable: table

Osuji Kingsley
  • 371
  • 3
  • 18

1 Answers1

2

I think your down() method missing code

It should look like this

public function down()
{
    Schema::table('users', function($table) {
        $table->dropColumn([
            'store_title',
            'store_description',
            'background_color',
            'font_color',
            'font_family',
            'last_seen'
        ]);
    });
}    

In your code its complaining about $table variable as it was not defined, also instead dropDown you need to use dropColumn.

if any doubts please comment.

Hardik Satasiya
  • 9,547
  • 3
  • 22
  • 40