Created
April 2, 2026 17:06
-
-
Save jasonkarns/848e52fe1252bbbad55bfb0420c13d63 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace :db do | |
| task disconnect: :environment do | |
| ActiveRecord::Base.clear_all_connections! | |
| end | |
| desc "Run migrations from scratch (destructive!!) to validate the veracity of the versioned schema." | |
| task lint: %w[environment disconnect drop create migrate] do | |
| schema = ActiveRecord::Tasks::DatabaseTasks.schema_dump_path ActiveRecord::Base.connection_db_config | |
| sh(*%w[git diff --exit-code --], schema) do |ok, res| | |
| abort "db schema must match the result of running migrations" unless ok | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment