Drops.Relation.Schema.ForeignKey (drops_relation v0.1.0)
View SourceRepresents a foreign key relationship in a database table/schema.
This struct stores information about a foreign key field and its reference to another table and field.
Examples
# Simple foreign key
%Drops.Relation.Schema.ForeignKey{
field: :user_id,
references_table: "users",
references_field: :id
}
Summary
Functions
Creates a new ForeignKey struct.
Types
Functions
Creates a new ForeignKey struct.
Parameters
field
- The foreign key field name in the current tablereferences_table
- The name of the referenced tablereferences_field
- The field name in the referenced table
Examples
iex> Drops.Relation.Schema.ForeignKey.new(:user_id, "users", :id, :user)
%Drops.Relation.Schema.ForeignKey{
field: :user_id,
references_table: "users",
references_field: :id
}