Skip to content

Commit

Permalink
small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ka8725 committed May 1, 2024
1 parent 848b048 commit 61a8640
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/actual_db_schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,22 @@ def self.migrated_folder
end

def self.migrated_folders
return [Rails.root.join("tmp", "migrated")] unless migrations_paths
return [default_migrated_folder] unless migrations_paths

Array(migrations_paths).map do |path|
if path.end_with?("db/migrate")
Rails.root.join("tmp", "migrated")
default_migrated_folder
else
postfix = path.split("/").last
Rails.root.join("tmp", "migrated_#{postfix}")
end
end
end

def default_migrated_folder
Rails.root.join("tmp", "migrated")
end

def self.migrations_paths
ActiveRecord::Base.connection_db_config.migrations_paths
end
Expand Down

0 comments on commit 61a8640

Please sign in to comment.