Skip to content

Add multiple databases AR bug template [ci skip]

Created by: HeyNonster

Motivation / Background

This Pull Request has been created because there are a few PRs we'd like to open that relate to the multiple database code in Rails but there was no existing template for a multiple database setup. 🙂

Detail

This commit adds a new bug report template that's based off of the existing Active Record bug report template but creates a multiple database setup.

The template creates an UnshardedModel abstract ActiveRecord model that connects to a single database (with a replica configured) and a ShardedModel abstract ActiveRecord model that has two shards configured, each with their own replica.

Each sqlite3 in-memory database is separate because opening multiple database connections each with the filename ":memory:" will create independent in-memory databases.

Note, that while replica databases are configured, sqlite3 does not support database replication and therefore records written to the writer databases will not auto-populate on the replica/reader databases. The replica configurations are included to allow for testing role switching, not for validating replication itself.

Additional information

You can test that the template works by running:

ruby guides/bug_report_templates/active_record_multiple_databases.rb

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

Merge request reports