1 week ago

UUID Foreign Key - Unable to add constraint

Posted 1 week ago by ramsom

I am trying to create a foreign key between space and user however I keep getting the following error:

SQLSTATE[HY000]: General error: 1824 Failed to open the referenced table 'spaces' (SQL: alter table users add constraint users_space_id_foreign foreign key (space_id) references spaces (id))

this article does reference a similar problem https://laracasts.com/discuss/channels/laravel/using-uuid-my-foreign-key-constraints-fail. However, it does not solve my problem. I am still a bit of a Noob so any help will be appreciated.

The users

Schema::create('users', function (Blueprint $table) {



Schema::create('spaces', function (Blueprint $table) {

Please sign in or create an account to participate in this conversation.