Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate pivot table issue #395

Open
dbwhddn10 opened this issue Sep 21, 2014 · 0 comments
Open

generate pivot table issue #395

dbwhddn10 opened this issue Sep 21, 2014 · 0 comments

Comments

@dbwhddn10
Copy link
Contributor

when laravel5 and laravel-generators ~3.0

$table->integer('role_id')->unsigned()->index();
$table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade');

error occurred when execute php artisan migrate

  [Illuminate\Database\QueryException]
  SQLSTATE[HY000]: General error: 1005 Can't create table 'laravel.#sql-a93_6186' (errno: 150) (SQL: alter table `role_user` add constraint role_user_role_id_foreign foreign key (`role_id`) references `roles` (`id`) on delete cascad
  e)

  [PDOException]
  SQLSTATE[HY000]: General error: 1005 Can't create table 'laravel.#sql-a93_6186' (errno: 150)

but
$table->integer('role_id')->unsigned()->index()->references('id')->on('roles')->onDelete('cascade');
is no error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant