BKWLD / decoy

A Laravel model-based CMS
http://docs.decoy.bukwild.com/
MIT License
303 stars 44 forks source link

General error: 1364 Field 'locale_group' doesn't have a default value #60

Closed SomosAMambo closed 6 years ago

SomosAMambo commented 7 years ago

Guys,

I get this with latest dev/master when saving elements. More specifically when saving a new element for the first time.

weotch commented 7 years ago

Remind me what DB you're using? Maybe we just need to add a default value to the migration...

SomosAMambo commented 7 years ago

Ok... did it.

class AddDefaultValueToLocaleGroupInElements extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('elements', function (Blueprint $table) {
            $table->string('locale_group')->default('')->change();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('elements', function (Blueprint $table) {
            $table->string('locale_group')->default(NULL)->change();
        });
    }
}
SomosAMambo commented 7 years ago

@weotch You may close this. But I think it would be nice to new users to have the default value in the original migration.