-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.rb
19 lines (18 loc) · 884 Bytes
/
utils.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class FullStackChallengesUtils
def self.rake_migrate(db_namespace, folder)
ActiveRecord::Migrator.migrations_paths = [File.join(folder, 'db/migrate')]
ActiveRecord::Migration.verbose = true
version = ENV['VERSION'] ? ENV['VERSION'].to_i : nil
args = [ActiveRecord::Migrator.migrations_paths]
args << ActiveRecord::SchemaMigration if ActiveRecord.version.to_s >= "6.0.0"
ActiveRecord::MigrationContext.new(*args).migrate(version)
db_namespace["schema:dump"].invoke
end
def self.spec_helper_migrate(version, folder)
ActiveRecord::Migration.verbose = false
ActiveRecord::Migrator.migrations_paths = [File.join(folder, '../db/migrate')]
args = [ActiveRecord::Migrator.migrations_paths]
args << ActiveRecord::SchemaMigration if ActiveRecord.version.to_s >= "6.0.0"
ActiveRecord::MigrationContext.new(*args).migrate(version)
end
end