Skip to content

Add trilogy adapter support and make mysql2 optional - #751

Merged
kbrock merged 1 commit into
stefankroes:masterfrom
kbrock:optional_mysql
Mar 31, 2026
Merged

Add trilogy adapter support and make mysql2 optional#751
kbrock merged 1 commit into
stefankroes:masterfrom
kbrock:optional_mysql

Conversation

@kbrock

@kbrock kbrock commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator

Description

mysql2 gem requires native MySQL client libraries which not all developers have installed, making bundle install fail. Gate mysql2 behind BUNDLE_INSTALL_MYSQL=1 in the main Gemfile so developers without MySQL can still contribute.

Also adds trilogy adapter support — trilogy is the modern MySQL driver (no mysql client deps) used by Rails 7.1+ by default.

Inspired by #749 (thx @djberg96).

Before

bundle install fails without MySQL client libraries installed.
Trilogy adapter not supported.

After

bundle install works without MySQL. Set BUNDLE_INSTALL_MYSQL=1 to include mysql2.
Trilogy adapter works with DB=trilogy.
CI runs both mysql2 and trilogy on the mysql matrix entry.

Type of Change

  • Feature

Checklist

  • My code follows the style guidelines
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally (bundle exec rake test)

How Has This Been Tested?

  • bundle exec rake test — sqlite default (250 runs, 0 failures)
  • Verified bundle install works without BUNDLE_INSTALL_MYSQL
  • Verified all adapter name checks include "trilogy" alongside "mysql2"

mysql2 requires native MySQL libraries which not all developers have
installed. Gate mysql2 behind BUNDLE_INSTALL_MYSQL=1 in the main
Gemfile. Appraisal gemfiles keep mysql2 hardcoded for CI.

Add trilogy adapter support throughout:
- Add "trilogy" to all mysql adapter name checks in format modules
- Add trilogy to database.yml configs (example and CI)
- Add trilogy test step to CI (runs on the mysql matrix entry)
- Add trilogy to gemfile_72 for CI
- Normalize DB=trilogy in test environment

Co-Authored-By: Daniel Berger <78529+djberg96@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kbrock
kbrock merged commit 0bc6dda into stefankroes:master Mar 31, 2026
11 checks passed
@kbrock
kbrock deleted the optional_mysql branch March 31, 2026 04:43
kbrock added a commit to kbrock/ancestry that referenced this pull request Mar 31, 2026
Add trilogy adapter support and make mysql2 optional
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant