method

foreign_key

Importance_1
v6.1.3.1 - Show latest stable - 0 notes - Class: Table
foreign_key(*args, **options) public

Adds a foreign key to the table using a supplied table name.

t.foreign_key(:authors)
t.foreign_key(:authors, column: :author_id, primary_key: "id")

See {connection.add_foreign_key}[rdoc-ref:SchemaStatements#add_foreign_key]

Show source
Register or log in to add new notes.