Class: Gitlab::Database::Migration::V1_0

Inherits:
Object
  • Object
show all
Includes:
LockRetriesConcern, Gitlab::Database::MigrationHelpers::AnnounceDatabase, Gitlab::Database::MigrationHelpers::V2
Defined in:
lib/gitlab/database/migration.rb

Overview

This implements a simple versioning scheme for migration helpers.

We need to be able to version helpers, so we can change their behavior without altering the behavior of already existing migrations in incompatible ways.

We can continue to change the behavior of helpers without bumping the version here, if the change is backwards-compatible.

If not, we would typically override the helper method in a new MigrationHelpers::V+ class and create a new entry with a bumped version below.

We use major version bumps to indicate significant changes and minor version bumps to indicate backwards-compatible or otherwise minor changes (e.g. a Rails version bump). However, this hasn’t been strictly formalized yet.

Direct Known Subclasses

V2_0

Defined Under Namespace

Classes: MigrationRecord

Constant Summary

Constants included from Gitlab::Database::MigrationHelpers

Gitlab::Database::MigrationHelpers::DEFAULT_TIMESTAMP_COLUMNS

Constants included from DynamicModelHelpers

DynamicModelHelpers::BATCH_SIZE

Constants included from Gitlab::Database::Migrations::RedisHelpers

Gitlab::Database::Migrations::RedisHelpers::SCAN_START_CURSOR

Constants included from Gitlab::Database::Migrations::SidekiqHelpers

Gitlab::Database::Migrations::SidekiqHelpers::DEFAULT_MAX_ATTEMPTS, Gitlab::Database::Migrations::SidekiqHelpers::DEFAULT_TIMES_IN_A_ROW

Constants included from Gitlab::Database::Migrations::ConstraintsHelpers

Gitlab::Database::Migrations::ConstraintsHelpers::MAX_IDENTIFIER_NAME_LENGTH

Constants included from Gitlab::Database::Migrations::BatchedBackgroundMigrationHelpers

Gitlab::Database::Migrations::BatchedBackgroundMigrationHelpers::BATCH_CLASS_NAME, Gitlab::Database::Migrations::BatchedBackgroundMigrationHelpers::BATCH_MIN_DELAY, Gitlab::Database::Migrations::BatchedBackgroundMigrationHelpers::BATCH_MIN_VALUE, Gitlab::Database::Migrations::BatchedBackgroundMigrationHelpers::BATCH_SIZE, Gitlab::Database::Migrations::BatchedBackgroundMigrationHelpers::NonExistentMigrationError, Gitlab::Database::Migrations::BatchedBackgroundMigrationHelpers::SUB_BATCH_SIZE

Constants included from Gitlab::Database::Migrations::BackgroundMigrationHelpers

Gitlab::Database::Migrations::BackgroundMigrationHelpers::BATCH_SIZE, Gitlab::Database::Migrations::BackgroundMigrationHelpers::JOB_BUFFER_SIZE

Method Summary

Methods included from Gitlab::Database::MigrationHelpers::AnnounceDatabase

#db_config_name, #write

Methods included from Gitlab::Database::MigrationHelpers::V2

#cleanup_concurrent_column_rename, #create_table, #rename_column_concurrently, #truncate_tables!, #undo_cleanup_concurrent_column_rename, #undo_rename_column_concurrently, #with_lock_retries

Methods included from Gitlab::Database::MigrationHelpers

#add_concurrent_foreign_key, #add_concurrent_index, #add_primary_key_using_index, #add_sequence, #add_timestamps_with_timezone, #backfill_conversion_of_integer_to_bigint, #backfill_iids, #change_column_type_concurrently, #check_trigger_permissions!, #cleanup_concurrent_column_rename, #cleanup_concurrent_column_type_change, #column_for, #concurrent_foreign_key_name, #convert_to_bigint_column, #convert_to_type_column, #copy_foreign_keys, #copy_indexes, #create_or_update_plan_limit, #create_temporary_columns_and_triggers, #define_batchable_model, #drop_sequence, #each_batch, #each_batch_range, #false_value, #foreign_key_exists?, #foreign_keys_for, #index_exists_by_name?, #index_invalid?, #indexes_for, #initialize_conversion_of_integer_to_bigint, #install_rename_triggers, #partition?, #postgres_exists_by_name?, #remove_column_default, #remove_concurrent_index, #remove_concurrent_index_by_name, #remove_foreign_key_if_exists, #remove_foreign_key_without_error, #remove_rename_triggers, #remove_timestamps, #rename_column_concurrently, #rename_trigger_name, #replace_sql, #restore_conversion_of_integer_to_bigint, #revert_backfill_conversion_of_integer_to_bigint, #revert_initialize_conversion_of_integer_to_bigint, #swap_primary_key, #table_partitioned?, #true_value, #undo_change_column_type_concurrently, #undo_cleanup_concurrent_column_rename, #undo_cleanup_concurrent_column_type_change, #undo_rename_column_concurrently, #update_column_in_batches, #validate_foreign_key

Methods included from Gitlab::Database::MigrationHelpers::WraparoundVacuumHelpers

#check_if_wraparound_in_progress

Methods included from AsyncConstraints::MigrationHelpers

#prepare_async_check_constraint_validation, #prepare_async_foreign_key_validation, #prepare_partitioned_async_foreign_key_validation, #unprepare_async_check_constraint_validation, #unprepare_async_foreign_key_validation, #unprepare_partitioned_async_foreign_key_validation

Methods included from AsyncIndexes::MigrationHelpers

#async_index_creation_available?, #prepare_async_index, #prepare_async_index_from_sql, #prepare_async_index_removal, #unprepare_async_index, #unprepare_async_index_by_name

Methods included from RenameTableHelpers

#finalize_table_rename, #rename_table_safely, #undo_finalize_table_rename, #undo_rename_table_safely

Methods included from DynamicModelHelpers

#define_batchable_model, #each_batch, #each_batch_range

Methods included from Gitlab::Database::Migrations::RedisHelpers

#queue_redis_migration_job

Methods included from Gitlab::Database::Migrations::SidekiqHelpers

#sidekiq_queue_length, #sidekiq_queue_migrate, #sidekiq_remove_jobs

Methods included from Gitlab::Database::Migrations::ExtensionHelpers

#create_extension, #drop_extension

Methods included from Gitlab::Database::Migrations::ConstraintsHelpers

#add_check_constraint, #add_not_null_constraint, #add_text_limit, #check_constraint_exists?, check_constraint_exists?, #check_constraint_name, #check_not_null_constraint_exists?, #check_text_limit_exists?, #copy_check_constraints, #drop_constraint, #remove_check_constraint, #remove_not_null_constraint, #remove_text_limit, #rename_constraint, #switch_constraint_names, #text_limit_name, #validate_check_constraint, #validate_check_constraint_name!, #validate_not_null_constraint, #validate_text_limit

Methods included from Gitlab::Database::Migrations::TimeoutHelpers

#disable_statement_timeout

Methods included from Gitlab::Database::Migrations::LockRetriesHelpers

#with_lock_retries

Methods included from Gitlab::Database::Migrations::BatchedBackgroundMigrationHelpers

#delete_batched_background_migration, #ensure_batched_background_migration_is_finished, #finalize_batched_background_migration, #gitlab_schema_from_context, #queue_batched_background_migration

Methods included from Gitlab::Database::Migrations::BackgroundMigrationHelpers

#delete_job_tracking, #delete_queued_jobs, #finalize_background_migration, #migrate_in, #queue_background_migration_jobs_by_range_at_intervals, #requeue_background_migration_jobs_by_range_at_intervals

Methods included from Gitlab::Database::Migrations::ReestablishedConnectionStack

#with_restored_connection_stack