Module: StrongMigrations
- Defined in:
- lib/strong_migrations/checks.rb,
lib/strong_migrations.rb,
lib/strong_migrations/checker.rb,
lib/strong_migrations/railtie.rb,
lib/strong_migrations/version.rb,
lib/strong_migrations/migrator.rb,
lib/strong_migrations/migration.rb,
lib/strong_migrations/safe_methods.rb,
lib/strong_migrations/schema_dumper.rb,
lib/strong_migrations/error_messages.rb,
lib/strong_migrations/migration_context.rb,
lib/strong_migrations/adapters/mysql_adapter.rb,
lib/strong_migrations/adapters/mariadb_adapter.rb,
lib/strong_migrations/adapters/abstract_adapter.rb,
lib/strong_migrations/adapters/postgresql_adapter.rb,
lib/generators/strong_migrations/install_generator.rb
Overview
note: MariaDB inherits from this adapter when making changes, be sure to see how it affects it
Defined Under Namespace
Modules: Adapters, Checks, Generators, Migration, MigrationContext, Migrator, SafeMethods, SchemaDumper Classes: Checker, Error, Railtie, UnsafeMigration, UnsupportedVersion, WrappedConnection
Constant Summary collapse
- VERSION =
"2.1.0"
Class Attribute Summary collapse
-
.alphabetize_schema ⇒ Object
Returns the value of attribute alphabetize_schema.
-
.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
-
.lock_timeout_retries ⇒ Object
Returns the value of attribute lock_timeout_retries.
-
.lock_timeout_retry_delay ⇒ Object
Returns the value of attribute lock_timeout_retry_delay.
-
.remove_invalid_indexes ⇒ Object
Returns the value of attribute remove_invalid_indexes.
-
.safe_by_default ⇒ Object
Returns the value of attribute safe_by_default.
-
.skipped_databases ⇒ Object
Returns the value of attribute skipped_databases.
-
.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_sql_mode ⇒ Object
Returns the value of attribute target_sql_mode.
-
.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
-
.env ⇒ Object
private.
- .skip_database(database) ⇒ Object
Class Attribute Details
.alphabetize_schema ⇒ Object
Returns the value of attribute alphabetize_schema.
28 29 30 |
# File 'lib/strong_migrations.rb', line 28 def alphabetize_schema @alphabetize_schema end |
.auto_analyze ⇒ Object
Returns the value of attribute auto_analyze.
28 29 30 |
# File 'lib/strong_migrations.rb', line 28 def auto_analyze @auto_analyze end |
.check_down ⇒ Object
Returns the value of attribute check_down.
28 29 30 |
# File 'lib/strong_migrations.rb', line 28 def check_down @check_down end |
.checks ⇒ Object
Returns the value of attribute checks.
28 29 30 |
# File 'lib/strong_migrations.rb', line 28 def checks @checks end |
.enabled_checks ⇒ Object
Returns the value of attribute enabled_checks.
28 29 30 |
# File 'lib/strong_migrations.rb', line 28 def enabled_checks @enabled_checks end |
.error_messages ⇒ Object
Returns the value of attribute error_messages.
28 29 30 |
# File 'lib/strong_migrations.rb', line 28 def @error_messages end |
.lock_timeout ⇒ Object
Returns the value of attribute lock_timeout.
28 29 30 |
# File 'lib/strong_migrations.rb', line 28 def lock_timeout @lock_timeout end |
.lock_timeout_limit ⇒ Object
61 62 63 64 65 66 |
# File 'lib/strong_migrations.rb', line 61 def self.lock_timeout_limit unless defined?(@lock_timeout_limit) @lock_timeout_limit = developer_env? ? false : 10 end @lock_timeout_limit end |
.lock_timeout_retries ⇒ Object
Returns the value of attribute lock_timeout_retries.
28 29 30 |
# File 'lib/strong_migrations.rb', line 28 def lock_timeout_retries @lock_timeout_retries end |
.lock_timeout_retry_delay ⇒ Object
Returns the value of attribute lock_timeout_retry_delay.
28 29 30 |
# File 'lib/strong_migrations.rb', line 28 def lock_timeout_retry_delay @lock_timeout_retry_delay end |
.remove_invalid_indexes ⇒ Object
Returns the value of attribute remove_invalid_indexes.
28 29 30 |
# File 'lib/strong_migrations.rb', line 28 def remove_invalid_indexes @remove_invalid_indexes end |
.safe_by_default ⇒ Object
Returns the value of attribute safe_by_default.
28 29 30 |
# File 'lib/strong_migrations.rb', line 28 def safe_by_default @safe_by_default end |
.skipped_databases ⇒ Object
Returns the value of attribute skipped_databases.
28 29 30 |
# File 'lib/strong_migrations.rb', line 28 def skipped_databases @skipped_databases end |
.start_after ⇒ Object
Returns the value of attribute start_after.
28 29 30 |
# File 'lib/strong_migrations.rb', line 28 def start_after @start_after end |
.statement_timeout ⇒ Object
Returns the value of attribute statement_timeout.
28 29 30 |
# File 'lib/strong_migrations.rb', line 28 def statement_timeout @statement_timeout end |
.target_mariadb_version ⇒ Object
Returns the value of attribute target_mariadb_version.
28 29 30 |
# File 'lib/strong_migrations.rb', line 28 def target_mariadb_version @target_mariadb_version end |
.target_mysql_version ⇒ Object
Returns the value of attribute target_mysql_version.
28 29 30 |
# File 'lib/strong_migrations.rb', line 28 def target_mysql_version @target_mysql_version end |
.target_postgresql_version ⇒ Object
Returns the value of attribute target_postgresql_version.
28 29 30 |
# File 'lib/strong_migrations.rb', line 28 def target_postgresql_version @target_postgresql_version end |
.target_sql_mode ⇒ Object
Returns the value of attribute target_sql_mode.
28 29 30 |
# File 'lib/strong_migrations.rb', line 28 def target_sql_mode @target_sql_mode end |
.target_version ⇒ Object
Returns the value of attribute target_version.
28 29 30 |
# File 'lib/strong_migrations.rb', line 28 def target_version @target_version end |
Class Method Details
.add_check(&block) ⇒ Object
68 69 70 |
# File 'lib/strong_migrations.rb', line 68 def self.add_check(&block) checks << block end |
.check_enabled?(check, version: nil) ⇒ Boolean
80 81 82 83 84 85 86 87 |
# File 'lib/strong_migrations.rb', line 80 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
47 48 49 |
# File 'lib/strong_migrations.rb', line 47 def self.developer_env? env == "development" || env == "test" end |
.disable_check(check) ⇒ Object
76 77 78 |
# File 'lib/strong_migrations.rb', line 76 def self.disable_check(check) enabled_checks.delete(check) end |
.enable_check(check, start_after: nil) ⇒ Object
72 73 74 |
# File 'lib/strong_migrations.rb', line 72 def self.enable_check(check, start_after: nil) enabled_checks[check] = {start_after: start_after} end |
.env ⇒ Object
private
52 53 54 55 56 57 58 59 |
# File 'lib/strong_migrations.rb', line 52 def self.env if defined?(Rails.env) Rails.env else # default to production for safety ENV["RACK_ENV"] || "production" end end |
.skip_database(database) ⇒ Object
89 90 91 |
# File 'lib/strong_migrations.rb', line 89 def self.skip_database(database) self.skipped_databases << database end |