2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'app/services/peak_flow_utils/database_initializer_service.rb', line 2
def perform
path = File.realpath("#{__dir__}/../../../lib/peak_flow_utils/migrations")
create_schema_table unless schema_table_exists?
Dir["#{path}/[0-9]*_*.rb"].sort.map do |filename|
match = filename.match(/migrations\/(\d+)_(.+)\.rb\Z/)
next unless match
version = match[1]
next if version_migrated?(version)
require filename
migration = match[2].camelize.constantize
migration.migrate(:up)
register_migration_migrated(version)
end
succeed!
end
|