Skip to main content

REFERENCES

Constant REFERENCES 

Source
pub const REFERENCES: ColumnMarker;
Expand description

Establishes a foreign key reference to another table’s column.

§Example

#[column(REFERENCES = User::id)]
user_id: i32,

With the query feature this also generates relation accessors: a forward one on this table, named after the column without its _id suffix (user_id gives .user()), and a reverse one on the referenced table (see RELATION).

See: https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-FK