class Sequent::DryRun::ViewSchema
Subclass of Migrations::ViewSchema
to dry run a migration. This migration does not insert anything into the database, mainly usefull for performance testing migrations.
Public Instance Methods
migrate_dryrun(regex:, group_exponent: 3, limit: nil, offset: nil)
click to toggle source
# File lib/sequent/dry_run/view_schema.rb, line 12 def migrate_dryrun(regex:, group_exponent: 3, limit: nil, offset: nil) persistor = DryRun::ReadOnlyReplayOptimizedPostgresPersistor.new projectors = Sequent::Core::Migratable.all.select { |p| p.replay_persistor.nil? && p.name.match(regex || /.*/) } if projectors.present? Sequent.logger.info "Dry run using the following projectors: #{projectors.map(&:name).join(', ')}" starting = Process.clock_gettime(Process::CLOCK_MONOTONIC) groups = groups(group_exponent: group_exponent, limit: limit, offset: offset) replay!(persistor, projectors: projectors, groups: groups) ending = Process.clock_gettime(Process::CLOCK_MONOTONIC) Sequent.logger.info("Done migrate_dryrun for version #{Sequent.new_version} in #{ending - starting} s") end end
Private Instance Methods
insert_ids()
click to toggle source
override so no ids are inserted.
# File lib/sequent/dry_run/view_schema.rb, line 31 def insert_ids ->(progress, done, ids) {} end