Skip to content

Confusing error when running migrations with issues #256

@jwoertink

Description

@jwoertink

If you have the following

def migrate
  create table_for(Comment) do
    primary_key id : UUID
    add_timestamps
    add_belongs_to user : User, on_delete: :cascade
  end
end

Then you run lucky db.migrate, you may run in to an error that mentions something like:

foreign key constraint "comment_user_id_fkey" cannot be implemented (Exception)

This is because the user id might be UUID, but you forgot to add the foreign_key_type: UUID to your add_belongs_to.

If we have a way to catch this error, we should.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions