Skip to content

Commit

Permalink
Call rubocop after generating schema.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
renatolond committed Nov 14, 2024
1 parent 0219021 commit a39e8aa
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/rake_support/migrations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ def migrate_down(db, target_migration: nil)
# @param db (see .migrate)
# @return [void]
def dump_schema(db)
return unless Environment.development? || Environment.test?

db.extension :schema_dumper
schema = db.dump_schema_migration(same_db: true)
current_migration = db[:schema_migrations].order_by(Sequel[:filename].desc).get(:filename)
Expand All @@ -68,6 +70,7 @@ def dump_schema(db)
#{schema}"
File.write("db/schema.rb", schema)
system("#{Gem.bin_path("rubocop", "rubocop")} -a db/schema.rb > /dev/null")
end

# Creates a new migration file, will add a timestamp and +name+ to the file.
Expand Down

0 comments on commit a39e8aa

Please sign in to comment.