Module: OnlineMigrations::Migration
- Defined in:
- lib/online_migrations/migration.rb
Instance Method Summary collapse
-
#safety_assured(&block) ⇒ Object
Mark a command in the migration as safe, despite using a method that might otherwise be dangerous.
-
#stop!(message, header: "Custom check") ⇒ Object
Stop running migrations.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/online_migrations/migration.rb', line 19 def method_missing(method, *args, &block) if ar_schema? super elsif command_checker.check(method, *args, &block) if in_transaction? super elsif method == :with_lock_retries connection.with_lock_retries(*args, &block) else connection.with_lock_retries { super } end end end |
Instance Method Details
#safety_assured(&block) ⇒ Object
Mark a command in the migration as safe, despite using a method that might otherwise be dangerous.
48 49 50 |
# File 'lib/online_migrations/migration.rb', line 48 def safety_assured(&block) command_checker.class.safety_assured(&block) end |
#stop!(message, header: "Custom check") ⇒ Object
Stop running migrations.
It is intended for use in custom checks.
63 64 65 |
# File 'lib/online_migrations/migration.rb', line 63 def stop!(, header: "Custom check") raise OnlineMigrations::UnsafeMigration, "⚠️ [online_migrations] #{header} ⚠️\n\n#{}\n\n" end |