I have a migration that correctly created table at local vagrant server, but when I tried migrate at VPS with nginx it encounters strange error.
Local env is Vagrant/homestead (I don't know OS, sorry), VPS env is Debian 8, nginx. Laravel version 5.3 Migrations have to create 12 tables, but problem encountered before the end process, so 10 tables only created. By the way it shows that env and other settings is OK (I think) and just in 1 table 1 field is error
this is creation code:
public function up()
{
Schema::create('vicards', function (Blueprint $table) {
$table->increments('id');
$table->string('visi_slug', 100);
$table->unique('visi_slug', 'visi_slug_unique');
$table->integer('user_id');
$table->index('user_id', 'cards_user_id_index');
$table->string('user_slug', 100);
$table->index('user_slug', 'cards_user_slug_index');
$table->string('avatar', 44)->default(0);
$table->string('header', 80);
$table->string('price', 12);
$table->text('description');
$table->text('pictures'); // 5 pics * 20 symbols + 4 commas
$table->text('videos'); // 3 videos * 41 symbols + 2 commas
$table->text('contacts'); //
$table->text('links'); // links separated by commas
$table->text('styles'); // object serialized
$table->tinyInteger('actual', 1)->default(0);
$table->timestamps();
});
}
problem invokes this field
$table->tinyInteger('actual', 1)->default(0);
artisan interprets it in:
`actual` tinyint not null default '0' auto_increment primary key
and off-course it is error because 'auto_increment primary key' already exist - 1st field
Expected result - regular table creation.
I got error:
" [Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'actual' (SQL: create table vicards (id int unsigned not
null auto_increment primary key, visi_slug varchar(100) not null, user_id int not null, user_slug varchar(100) not null, avatar varchar
(44) not null default '0', header varchar(80) not null, price varchar(12) not null, description text not null, pictures text not null,
videos text not null, contacts text not null, links text not null, styles text not null, actual tinyint not null default '0' auto_inc
rement primary key, created_at timestamp null, updated_at timestamp null) default character set utf8 collate utf8_unicode_ci)"
What is cause of this error? Help me please.
Do not use lenght value, just create tinyint with default value: