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/database_tasks.rb,
lib/strong_migrations/unsafe_migration.rb,
lib/strong_migrations/alphabetize_columns.rb

Defined Under Namespace

Modules: AlphabetizeColumns, DatabaseTasks, Migration Classes: Checker, Railtie, UnsafeMigration

Constant Summary collapse

VERSION =
"0.5.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.auto_analyzeObject

Returns the value of attribute auto_analyze.



12
13
14
# File 'lib/strong_migrations.rb', line 12

def auto_analyze
  @auto_analyze
end

.checksObject

Returns the value of attribute checks.



12
13
14
# File 'lib/strong_migrations.rb', line 12

def checks
  @checks
end

.enabled_checksObject

Returns the value of attribute enabled_checks.



12
13
14
# File 'lib/strong_migrations.rb', line 12

def enabled_checks
  @enabled_checks
end

.error_messagesObject

Returns the value of attribute error_messages.



12
13
14
# File 'lib/strong_migrations.rb', line 12

def error_messages
  @error_messages
end

.start_afterObject

Returns the value of attribute start_after.



12
13
14
# File 'lib/strong_migrations.rb', line 12

def start_after
  @start_after
end

.target_postgresql_versionObject

Returns the value of attribute target_postgresql_version.



12
13
14
# File 'lib/strong_migrations.rb', line 12

def target_postgresql_version
  @target_postgresql_version
end

Class Method Details

.add_check(&block) ⇒ Object



194
195
196
# File 'lib/strong_migrations.rb', line 194

def self.add_check(&block)
  checks << block
end

.check_enabled?(check, version: nil) ⇒ Boolean



206
207
208
209
210
211
212
213
# File 'lib/strong_migrations.rb', line 206

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

.disable_check(check) ⇒ Object



202
203
204
# File 'lib/strong_migrations.rb', line 202

def self.disable_check(check)
  enabled_checks.delete(check)
end

.enable_check(check, start_after: nil) ⇒ Object



198
199
200
# File 'lib/strong_migrations.rb', line 198

def self.enable_check(check, start_after: nil)
  enabled_checks[check] = {start_after: start_after}
end