Module: PgHaMigrations

Defined in:
lib/pg_ha_migrations.rb,
lib/pg_ha_migrations/version.rb,
lib/pg_ha_migrations/relation.rb,
lib/pg_ha_migrations/lock_mode.rb,
lib/pg_ha_migrations/hacks/add_index_on_only.rb,
lib/pg_ha_migrations/hacks/disable_ddl_transaction.rb,
lib/pg_ha_migrations/blocking_database_transactions.rb,
lib/pg_ha_migrations/hacks/cleanup_unnecessary_output.rb,
lib/pg_ha_migrations/blocking_database_transactions_reporter.rb

Defined Under Namespace

Modules: ActiveRecordHacks, AllowedVersions, AutoIncluder, DependentObjectsChecks, SafeStatements, UnsafeStatements Classes: BlockingDatabaseTransactions, BlockingDatabaseTransactionsReporter, Config, Index, LockMode, PartmanConfig, Railtie, Relation, Table, TableCollection

Constant Summary collapse

LOCK_TIMEOUT_SECONDS =
5
LOCK_FAILURE_RETRY_DELAY_MULTLIPLIER =
5
SMALL_TABLE_THRESHOLD_BYTES =
10.megabytes
PARTITION_TYPES =
i[range list hash]
PARTMAN_UPDATE_CONFIG_OPTIONS =
i[
  infinite_time_partitions
  inherit_privileges
  premake
  retention
  retention_keep_table
]
UnsafeMigrationError =

Safe versus unsafe in this context specifically means the following:

  • Safe operations will not block for long periods of time.

  • Unsafe operations may block for long periods of time.

Class.new(StandardError)
InvalidMigrationError =

Invalid migrations are operations which we expect to not function as expected or get the schema into an inconsistent state

Class.new(StandardError)
BestPracticeError =

Operations violating a best practice, but not actually unsafe will raise this error. For example, adding a column without a default and then setting its default in a second action in a single migration isn’t our documented best practice and will raise this error.

Class.new(StandardError)
UnsupportedMigrationError =

Unsupported migrations use ActiveRecord::Migration features that we don’t support, and therefore will likely have unexpected behavior.

Class.new(StandardError)
UnsupportedAdapter =

This gem only supports the PostgreSQL adapter at this time.

Class.new(StandardError)
UndefinedTableError =

Some methods need to inspect the attributes of a table. In such cases, this error will be raised if the table does not exist

Class.new(StandardError)
VERSION =
"2.0.0"

Class Method Summary collapse

Class Method Details

.configObject



19
20
21
22
23
24
25
26
27
# File 'lib/pg_ha_migrations.rb', line 19

def self.config
  @config ||= Config.new(
    true,
    true,
    false,
    true,
    true
  )
end

.configure {|config| ... } ⇒ Object

Yields:



29
30
31
# File 'lib/pg_ha_migrations.rb', line 29

def self.configure
  yield config
end