I am trying to mimic wordpress' primary key size which is BIGINT(20) but it seems that laravel doesn't have a native function to do this.. I saw a page in the laravel forums and got a code like this:
$table->bigInteger('id')->primary();
but when i try to attach a foreign key to that id during artisan migrate
, there is a MYSQL error that is thrown:
[Exception] SQLSTATE[HY000]: General error: 1005 Can't create table 'db.#sql- 1730_15' (errno: 150) (SQL: alter table
users
add constraint users_role_id_foreign foreign key (role_id
) referencesroles
(id
)) (Bindings: array ( ))
What is the proper way to do this or where do i get this thing wrong?
thanks!