Module: StrongMigrations
- Defined in:
- lib/strong_migrations.rb,
lib/strong_migrations/checker.rb,
lib/strong_migrations/railtie.rb,
lib/strong_migrations/version.rb,
lib/strong_migrations/migration.rb,
lib/strong_migrations/safe_methods.rb,
lib/strong_migrations/database_tasks.rb,
lib/strong_migrations/alphabetize_columns.rb,
lib/generators/strong_migrations/install_generator.rb
Defined Under Namespace
Modules: AlphabetizeColumns, DatabaseTasks, Generators, Migration, SafeMethods Classes: Checker, Error, Railtie, UnsafeMigration
Constant Summary collapse
- VERSION =
"0.7.5"
Class Attribute Summary collapse
-
.auto_analyze ⇒ Object
Returns the value of attribute auto_analyze.
-
.check_down ⇒ Object
Returns the value of attribute check_down.
-
.checks ⇒ Object
Returns the value of attribute checks.
-
.enabled_checks ⇒ Object
Returns the value of attribute enabled_checks.
-
.error_messages ⇒ Object
Returns the value of attribute error_messages.
-
.lock_timeout ⇒ Object
Returns the value of attribute lock_timeout.
- .lock_timeout_limit ⇒ Object
-
.safe_by_default ⇒ Object
Returns the value of attribute safe_by_default.
-
.start_after ⇒ Object
Returns the value of attribute start_after.
-
.statement_timeout ⇒ Object
Returns the value of attribute statement_timeout.
-
.target_mariadb_version ⇒ Object
Returns the value of attribute target_mariadb_version.
-
.target_mysql_version ⇒ Object
Returns the value of attribute target_mysql_version.
-
.target_postgresql_version ⇒ Object
Returns the value of attribute target_postgresql_version.
-
.target_version ⇒ Object
Returns the value of attribute target_version.
Class Method Summary collapse
- .add_check(&block) ⇒ Object
- .check_enabled?(check, version: nil) ⇒ Boolean
-
.developer_env? ⇒ Boolean
private.
- .disable_check(check) ⇒ Object
- .enable_check(check, start_after: nil) ⇒ Object
Class Attribute Details
.auto_analyze ⇒ Object
Returns the value of attribute auto_analyze.
19 20 21 |
# File 'lib/strong_migrations.rb', line 19 def auto_analyze @auto_analyze end |
.check_down ⇒ Object
Returns the value of attribute check_down.
19 20 21 |
# File 'lib/strong_migrations.rb', line 19 def check_down @check_down end |
.checks ⇒ Object
Returns the value of attribute checks.
19 20 21 |
# File 'lib/strong_migrations.rb', line 19 def checks @checks end |
.enabled_checks ⇒ Object
Returns the value of attribute enabled_checks.
19 20 21 |
# File 'lib/strong_migrations.rb', line 19 def enabled_checks @enabled_checks end |
.error_messages ⇒ Object
Returns the value of attribute error_messages.
19 20 21 |
# File 'lib/strong_migrations.rb', line 19 def @error_messages end |
.lock_timeout ⇒ Object
Returns the value of attribute lock_timeout.
19 20 21 |
# File 'lib/strong_migrations.rb', line 19 def lock_timeout @lock_timeout end |
.lock_timeout_limit ⇒ Object
253 254 255 256 257 258 |
# File 'lib/strong_migrations.rb', line 253 def self.lock_timeout_limit unless defined?(@lock_timeout_limit) @lock_timeout_limit = developer_env? ? false : 10 end @lock_timeout_limit end |
.safe_by_default ⇒ Object
Returns the value of attribute safe_by_default.
19 20 21 |
# File 'lib/strong_migrations.rb', line 19 def safe_by_default @safe_by_default end |
.start_after ⇒ Object
Returns the value of attribute start_after.
19 20 21 |
# File 'lib/strong_migrations.rb', line 19 def start_after @start_after end |
.statement_timeout ⇒ Object
Returns the value of attribute statement_timeout.
19 20 21 |
# File 'lib/strong_migrations.rb', line 19 def statement_timeout @statement_timeout end |
.target_mariadb_version ⇒ Object
Returns the value of attribute target_mariadb_version.
19 20 21 |
# File 'lib/strong_migrations.rb', line 19 def target_mariadb_version @target_mariadb_version end |
.target_mysql_version ⇒ Object
Returns the value of attribute target_mysql_version.
19 20 21 |
# File 'lib/strong_migrations.rb', line 19 def target_mysql_version @target_mysql_version end |
.target_postgresql_version ⇒ Object
Returns the value of attribute target_postgresql_version.
19 20 21 |
# File 'lib/strong_migrations.rb', line 19 def target_postgresql_version @target_postgresql_version end |
.target_version ⇒ Object
Returns the value of attribute target_version.
19 20 21 |
# File 'lib/strong_migrations.rb', line 19 def target_version @target_version end |
Class Method Details
.add_check(&block) ⇒ Object
260 261 262 |
# File 'lib/strong_migrations.rb', line 260 def self.add_check(&block) checks << block end |
.check_enabled?(check, version: nil) ⇒ Boolean
272 273 274 275 276 277 278 279 |
# File 'lib/strong_migrations.rb', line 272 def self.check_enabled?(check, version: nil) if enabled_checks[check] start_after = enabled_checks[check][:start_after] || StrongMigrations.start_after !version || version > start_after else false end end |
.developer_env? ⇒ Boolean
private
249 250 251 |
# File 'lib/strong_migrations.rb', line 249 def self.developer_env? defined?(Rails) && (Rails.env.development? || Rails.env.test?) end |
.disable_check(check) ⇒ Object
268 269 270 |
# File 'lib/strong_migrations.rb', line 268 def self.disable_check(check) enabled_checks.delete(check) end |
.enable_check(check, start_after: nil) ⇒ Object
264 265 266 |
# File 'lib/strong_migrations.rb', line 264 def self.enable_check(check, start_after: nil) enabled_checks[check] = {start_after: start_after} end |