Adds foreign key helpers to ActiveRecord migrations and dumps foreign keys to schema.rb for MySQL, PostgreSQL, and SQLite.
Foreigner is a Ruby gem that adds foreign key support to ActiveRecord migrations for Rails applications. It provides migration helpers to create and remove foreign key constraints and ensures these constraints are properly reflected in the schema.rb file. It was designed for Rails versions before native foreign key support was introduced in Rails 4.2.
Rails developers working with MySQL, PostgreSQL, or SQLite databases who need to manage foreign key constraints in their migrations and schema files, particularly those using Rails versions prior to 4.2.
Foreigner offers a simple, database-agnostic API for defining foreign keys in migrations, ensuring data integrity and consistent schema dumps. It integrates seamlessly with ActiveRecord's migration DSL and supports key database adapters without requiring raw SQL.
Adds foreign key helpers to migrations and correctly dumps foreign keys to schema.rb
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Adds foreign_key and remove_foreign_key methods directly to ActiveRecord migrations, enabling clean DSL usage as shown in the README examples, including integration with create_table and change_table blocks.
Ensures foreign key constraints are properly included in schema.rb for MySQL and PostgreSQL, maintaining consistency between database and schema files without manual edits.
Provides a unified interface for managing foreign keys across supported adapters (mysql2, postgres, sqlite), abstracting away database differences and simplifying migrations.
Allows specifying dependent behavior like :delete directly on foreign key constraints, integrating data integrity rules into migrations rather than relying solely on model associations.
Rendered unnecessary by Rails 4.2's native foreign key support, making it irrelevant for new projects or upgrades, and likely unmaintained or deprecated.
Only supports mysql2, postgres, and sqlite, with SQLite methods being no-ops, so it's ineffective for databases like Oracle or SQL Server without additional plugins.
Does not support database-specific foreign key options directly; developers must use raw SQL via the :options parameter for advanced constraints, as admitted in the README.