Skip to content

Allow specifying primary key on has_many and has_one relationships #490

@matthewmcgarvey

Description

@matthewmcgarvey

Right now we assume that the connected table always points at the table's primary key. This makes sense for the VAST majority of cases but this causes issues when we want to add support for tables without primary keys and it's also possible to do joins on non-primary key columns. This is a bad example, but here is what it would look like:

class User
  table do
    column name : String
    has_many name_infos : NameInfo, foreign_key: "user_name", primary_key: "name"
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions