Add installable migrations system for easier upgrades #66
+544
−379
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The current schema file approach () has a critical limitation that affects upgrades:
This check causes the schema loader to skip execution if tables already exist, making it impossible to add new columns when releasing gem updates.
Real-World Impact
When v0.2.4 added the tagging feature with new
tagscolumns, existing installations experienced this error:Users had to manually create migrations to add the missing columns, resulting in:
Solution
This PR implements installable migrations following Rails community standards (like ActiveStorage, ActionText, Solid Queue, Devise, Doorkeeper).
What Changed
1. New Migration-Based Installation (Default)
rails generate rails_pulse:install # Now creates migrations rails db:migrateBenefits:
db:migrate:status2. Intelligent Upgrade Generator
Features:
3. Standalone Migrations Generator
Copies all migration templates to your app for manual review/customization.
New Migration Templates
All templates include existence checks for idempotency:
Backwards Compatibility
✅ Existing schema-based installations continue working
✅ Legacy behavior available via
--use_schemaflag✅ No breaking changes to existing APIs
✅ Schema file maintained for backwards compatibility
Documentation
Added comprehensive "Upgrading" section to README covering:
Why This Matters
Industry Standard Approach:
Most popular Rails gems use migrations:
rails generate devise:installrails generate doorkeeper:migrationrails generate solid_queue:installrails active_storage:install:migrationsDeveloper Expectations:
Rails developers understand and trust migrations. Using schema files for incremental updates is non-standard and causes confusion.
Production Safety:
Testing
This PR maintains all existing functionality while adding the new migration system:
Future Releases
With this system in place, future schema changes will be seamless:
rails generate rails_pulse:upgraderails db:migrateNo more manual intervention or two-stage deployments required.
This resolves the upgrade path issue and aligns Rails Pulse with Rails community standards. Would love feedback on the approach!