View Source Introspex.Postgres.RelationshipAnalyzer (Introspex v0.2.0)

Analyzes foreign key relationships between tables to determine Ecto associations (belongs_to, has_many, has_one, many_to_many).

Summary

Functions

Analyzes belongs_to relationships based on foreign keys in the current table.

Analyzes has_many relationships by looking for foreign keys in other tables that reference this table.

Analyzes has_one relationships (similar to has_many but with singular naming).

Analyzes many_to_many relationships by detecting join tables.

Analyzes all relationships for a given table and returns association definitions.

Determines if a table is likely a join table for many-to-many relationships.

Functions

Link to this function

analyze_belongs_to(foreign_keys, all_tables)

View Source

Analyzes belongs_to relationships based on foreign keys in the current table.

Link to this function

analyze_has_many(repo, table_name, all_tables, schema)

View Source

Analyzes has_many relationships by looking for foreign keys in other tables that reference this table.

Link to this function

analyze_has_one(repo, table_name, all_tables, schema)

View Source

Analyzes has_one relationships (similar to has_many but with singular naming).

Link to this function

analyze_many_to_many(repo, table_name, all_tables, schema)

View Source

Analyzes many_to_many relationships by detecting join tables.

Link to this function

analyze_relationships(repo, table_name, all_tables, schema \\ "public")

View Source

Analyzes all relationships for a given table and returns association definitions.

Link to this function

join_table?(table_name, repo, schema)

View Source

Determines if a table is likely a join table for many-to-many relationships.