Welcome to mirror list, hosted at ThFree Co, Russian Federation.

migration_helpers.rb « rubocop - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c066d424437257e0b540163f69432c00253a4d0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module RuboCop
  # Module containing helper methods for writing migration cops.
  module MigrationHelpers
    # Returns true if the given node originated from the db/migrate directory.
    def in_migration?(node)
      dirname = File.dirname(node.location.expression.source_buffer.name)

      dirname.end_with?('db/migrate', 'db/post_migrate')
    end

    def in_post_deployment_migration?(node)
      dirname = File.dirname(node.location.expression.source_buffer.name)

      dirname.end_with?('db/post_migrate')
    end
  end
end