I am having trouble to solve this, I have this create statement:
create table `roles`
(
`name` varchar(255) not null,
`description` varchar(255) not null,
`created_at` timestamp default 0 not null,
`updated_at` timestamp default 0 not null
) default character set utf8 collate utf8_unicode_ci;
But I am getting error:
Foreign key constraint is incorrectly formed
Can anybody suggest what I am doing wrong here ?
FYI, I am using MySQL.
Actual statement is run using Laravel migration which gives error:
public function up()
{
Schema::create('roles', function(Blueprint $table)
{
$table->string('name')->unique()->primary();
$table->string('description');
$table->timestamps();
});
}