Class: Sequent::DryRun::ViewSchema
- Inherits:
-
Migrations::ViewSchema
- Object
- Migrations::ViewSchema
- Sequent::DryRun::ViewSchema
- Defined in:
- lib/sequent/dry_run/view_schema.rb
Overview
Subclass of Migrations::ViewSchema to dry run a migration. This migration does not insert anything into the database, mainly usefull for performance testing migrations.
Instance Attribute Summary
Attributes inherited from Migrations::ViewSchema
#db_config, #logger, #view_schema
Instance Method Summary collapse
Methods inherited from Migrations::ViewSchema
#create_view_schema_if_not_exists, create_view_schema_if_not_exists, create_view_tables, #create_view_tables, #current_version, #executor, #initialize, #migrate_offline, #migrate_online, #plan, #replay_all!
Methods included from Migrations::Sql
#exec_sql, #sql_file_to_statements
Methods included from Util::Printer
Methods included from Util::Timer
Constructor Details
This class inherits a constructor from Sequent::Migrations::ViewSchema
Instance Method Details
#migrate_dryrun(regex:) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/sequent/dry_run/view_schema.rb', line 12 def migrate_dryrun(regex:) 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) replay!(persistor, projectors:) ending = Process.clock_gettime(Process::CLOCK_MONOTONIC) Sequent.logger.info("Done migrate_dryrun for version #{Sequent.new_version} in #{ending - starting} s") end end |