I am getting the following error:
SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'id' (SQL: create table
advertising(idbigint unsigned not null default 'None' auto_increment primary key,slugvarchar(50) collate 'utf8_unicode_ci' not null afterid,provider_namevarchar(100) collate 'utf8_unicode_ci' null,tracking_code_largetext collate 'utf8_unicode_ci' null,tracking_code_mediumtext collate 'utf8_unicode_ci' null,tracking_code_smalltext collate 'utf8_unicode_ci' null,activetinyint unsigned null default '1') default character set utf8 collate 'utf8_unicode_ci')
and this is my code :
public function up()
{
Schema::create('advertising',function(Blueprint $table){
$table->bigIncrements('id')->unsigned()->default('None')->nullable($value = false)->autoIncrement();
$table->string('slug',50)->after('id')->collation('utf8_unicode_ci')->nullable($value = false);
$table->string('provider_name',100)->collation('utf8_unicode_ci')->default(null)->nullable($value = true);
$table->text('tracking_code_large')->collation('utf8_unicode_ci')->default(null)->nullable($value = true);
$table->text('tracking_code_medium')->collation('utf8_unicode_ci')->default(null)->nullable($value = true);
$table->text('tracking_code_small')->collation('utf8_unicode_ci')->default(null)->nullable($value = true);
$table->tinyInteger('active')->unsigned()->nullable($value = true)->default(1);
});
}
I try to change value of id but its still get error.
idis expecting integer value you are passing string by default. And auto-increment field doesn't require any default value OR nullable. - Ashutosh Sharma