Class: Gitlab::Database::Migrations::Squasher
- Inherits:
-
Object
- Object
- Gitlab::Database::Migrations::Squasher
- Defined in:
- lib/gitlab/database/migrations/squasher.rb
Constant Summary collapse
- RSPEC_FILENAME_REGEXP =
/\A([0-9]+_)?([_a-z0-9]*)\.rb\z/
Instance Method Summary collapse
- #files_to_delete ⇒ Object
-
#initialize(git_output) ⇒ Squasher
constructor
A new instance of Squasher.
Constructor Details
#initialize(git_output) ⇒ Squasher
Returns a new instance of Squasher.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/gitlab/database/migrations/squasher.rb', line 11 def initialize(git_output) @migration_data = migration_files_from_git(git_output).filter_map do |mf| basename = Pathname(mf).basename.to_s file_name_match = ActiveRecord::Migration::MigrationFilenameRegexp.match(basename) slug = file_name_match[2] unless slug == 'init_schema' { path: mf, basename: basename, timestamp: file_name_match[1], slug: slug } end end end |
Instance Method Details
#files_to_delete ⇒ Object
27 28 29 |
# File 'lib/gitlab/database/migrations/squasher.rb', line 27 def files_to_delete @migration_data.pluck(:path) + schema_migrations + find_migration_specs end |