Making-Websites-With-October-CMS icon indicating copy to clipboard operation
Making-Websites-With-October-CMS copied to clipboard

Adding new fields to extended user's plugin

Open os-kingsley opened this issue 5 years ago • 0 comments

I extended the user's plugin going by the tutorial and it works ok. Now i want to add new fields using the same plugin i created for the extension by adding this as an additional 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_font')->nullable();
             $table->string('store_title_font_color')->nullable();
            $table->string('store_description_font')->nullable();
            $table->string('store_description_font_color')->nullable();
            $table->string('background_size')->nullable();

        });
    }

    public function down()
{
    Schema::table('users', function($table) {
        $table->dropColumn([
            'store_title_font',
            'store_title_font_color',
            'store_description_font',
            'store_description_font_color',
            'background_size',

        ]);
    });
} 

}

What i am not clear about or scared to try is what happens when i run php artisan plugin:refresh. Will the first table be dropped and rebuilt with the data saved in it deleted? or is there a different way of adding new fields to the already extended fields.

os-kingsley avatar Oct 18 '19 19:10 os-kingsley