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/extension.rb,
lib/pg_ha_migrations/lock_mode.rb,
lib/pg_ha_migrations/partman_rename_adapter.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: AbstractPartmanRenameAdapter, BlockingDatabaseTransactions, BlockingDatabaseTransactionsReporter, CheckConstraint, Config, DayToMonthPartmanRenameAdapter, Extension, Index, LockMode, MinuteToDayPartmanRenameAdapter, MonthToYearPartmanRenameAdapter, PartmanConfig, PartmanTable, QuarterlyPartmanRenameAdapter, Railtie, Relation, SecondToMinutePartmanRenameAdapter, Table, TableCollection, WeeklyPartmanRenameAdapter, YearToForeverPartmanRenameAdapter

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
]
PARTMAN_UNSUPPORTED_INTERVALS =
%w[
  yearly
  quarterly
  monthly
  weekly
  daily
  hourly
  half-hour
  quarter-hour
]
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)
MissingExtensionError =

Some methods rely on certain extensions being installed (e.g. partman).

Class.new(StandardError)
InvalidIdentifierError =

Some methods require table / schema names to be in a specific format.

Class.new(StandardError)
InvalidPartmanConfigError =

Some methods require the part_config entry to be in a specific state.

Class.new(StandardError)
VERSION =
"2.3.1"

Class Method Summary collapse

Class Method Details

.configObject



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

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

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

Yields:



31
32
33
# File 'lib/pg_ha_migrations.rb', line 31

def self.configure
  yield config
end