instance method
foreign_keys
Ruby on Rails 6.1.7.10
Since v5.2.8.1Signature
foreign_keys(table_name)
No documentation comment.
Parameters
-
table_namereq
Source
# File activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb, line 291
def foreign_keys(table_name)
fk_info = exec_query("PRAGMA foreign_key_list(#{quote(table_name)})", "SCHEMA")
fk_info.map do |row|
options = {
column: row["from"],
primary_key: row["to"],
on_delete: extract_foreign_key_action(row["on_delete"]),
on_update: extract_foreign_key_action(row["on_update"])
}
ForeignKeyDefinition.new(table_name, row["table"], options)
end
end
Defined in activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb line 291
· View on GitHub
· Improve this page
· Find usages on GitHub