gitlab-org--gitlab-foss/spec/migrations
Shinya Maeda ffa2637a0c Squashed commit of the following:
commit 8ea114e5c349ad23f7293cf8141798aa6c9384e3
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Fri Aug 17 13:32:14 2018 +0900

    Remove redandant parentheses

commit 3eb34f9305980701f0c1528f95fd615c1ca4d50d
Merge: 24308e4d1da 46494f46a1
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Fri Aug 17 13:22:05 2018 +0900

    Merge branch 'master-ce' into add-background-migration-for-legacy-traces

commit 24308e4d1dab6fbf8437afc56fff7b83cc7ce534
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Thu Aug 16 16:39:20 2018 +0900

    Fix spec

commit 5a63312d1b36296440da6a874bb667b7dc06869c
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Thu Aug 16 14:46:59 2018 +0900

    Format SQL in MIgrateLegacyArtifacts class

commit 8894196d2aa2f9bf153cb03fef9603858478db70
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Thu Aug 16 14:31:18 2018 +0900

    Remove unnecessary index

commit d9753ac058fc48c8f594ee90064f675f7a869b17
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Thu Aug 16 14:24:20 2018 +0900

    Decouple pertial index to a different migration file

commit 1ce4a9bec6a4f0f981f4139c1a146ca7d887e6ba
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Thu Aug 16 14:14:03 2018 +0900

    Simplified adding file_location column

commit 47b101fae914470dc4d048f6d33c509ec8270656
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Thu Aug 16 14:11:42 2018 +0900

    Remove add_column_with_default

commit 80ec4f774f50bbf66e65f283f8fba541c6334e1c
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Thu Aug 16 14:02:46 2018 +0900

    Simplified job_artifact_uploader

commit d835dab36e85f4fc7a7d0735ede0f0ea081178bf
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Thu Aug 16 13:59:03 2018 +0900

    Elaborate comments on `file_location`

commit 6e78f23683bbae1372783f19179206369d7fbae7
Merge: fcef07ef361 79fdfec51f
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Thu Aug 16 13:39:28 2018 +0900

    Merge branch 'master-ce' into add-background-migration-for-legacy-traces

commit fcef07ef361080823432071722897321b2dd8354
Merge: 1eac3083194 bf9fd9c3fc
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Fri Jul 6 21:46:22 2018 +0900

    Merge branch 'master' into add-background-migration-for-legacy-traces

commit 1eac30831947cceec7610be6acc7d3bffadaf617
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Fri Jul 6 21:45:49 2018 +0900

    Use SQL instead of strip_heredoc

commit 08b17e517722e1e4ef8b60e753d53d697953a293
Merge: c0f48ff243d dc478a8243
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Thu Jul 5 23:20:37 2018 +0900

    Merge branch 'master' into add-background-migration-for-legacy-traces

commit c0f48ff243ddbe8af6c63aa0170538717191f44a
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Thu Jul 5 17:37:40 2018 +0900

    Fix flaky spec

commit d082dab7cb456f9b31e76f49d1db46b606ba13ce
Merge: 8d6059d08ff 116955c453
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Thu Jul 5 17:35:06 2018 +0900

    Merge branch 'master' into add-background-migration-for-legacy-traces

commit 8d6059d08fffaa99689afe32b66d93b538fb62f2
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Jul 4 21:39:09 2018 +0900

    Fix static analysys failure

commit c4bdb18d582c520723a73c4c90c522332fa94d36
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Jul 4 20:16:16 2018 +0900

    Cleanup spec

commit 469e826429feb6a8ce66eb5d5e087f7182eb8813
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Jul 4 19:09:12 2018 +0900

    Clean up migrate_legacy_artifacts spec

commit dee84be650ad5afc9f18ac05eccb0736e4b1c121
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Jul 4 18:13:19 2018 +0900

    Set default value at the database level

commit b32cb2f8a7e03238cf97d90f9e05ca11b5c8b687
Merge: 83f7c970ad8 4c1a2a9b99
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Jul 4 17:06:02 2018 +0900

    Merge branch 'master' into add-background-migration-for-legacy-traces

commit 83f7c970ad821f1b52999398070facf59f320479
Merge: 823629c1d9a 275fbf24b1
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue Jul 3 18:39:36 2018 +0900

    Merge branch 'master' into add-background-migration-for-legacy-traces

commit 823629c1d9aac5e7dcfb6bc393557a72ca3370b4
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Mon Jul 2 14:59:54 2018 +0900

    Decouple background migrations of filling nullified file_locations

commit 42ec60e8a74478c62962f5c66abfbe3e908d9e49
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Mon Jul 2 14:46:38 2018 +0900

    Unify partial index migrations

commit c145e9306419f704b14e2a92f51a9cf2d105f7e7
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Mon Jul 2 14:24:14 2018 +0900

    Make file_location non-null values

commit a442456f6a83327b2736f49b9522084b5675d129
Merge: c2cafa1051c 3cf683629e
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Mon Jul 2 13:16:29 2018 +0900

    Merge branch 'master' into add-background-migration-for-legacy-traces

commit c2cafa1051cb7a4582c93b653e0ef3506ee11af4
Merge: 8e5f4f88410 e38db19659
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Thu Jun 28 17:13:48 2018 +0900

    Merge branch 'master' into add-background-migration-for-legacy-traces

commit 8e5f4f884107c0f574545f043fbacea2698ef3a4
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Jun 27 18:54:03 2018 +0900

    Remove unneccesary specs

commit 86c1c68b1000770fcf8086fa71801b332fb6df5a
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Jun 27 18:05:36 2018 +0900

    Add a partial index on ci_builds.id for legacy artifacts search

commit 70aa08c89bb6cd9b12d38b64cbf1838fb919c30f
Merge: 37801122986 292cf66890
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Jun 27 17:15:33 2018 +0900

    Merge branch 'master' into add-background-migration-for-legacy-traces

commit 378011229864c1e056cf995444f947f6b352172c
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Thu Jun 7 14:18:00 2018 +0900

    Clean up migration code. Defining migration custom class in  only post migration file which requires it for each_batch

commit 5cfe73318b91f377897e9fc50d67145093846459
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Jun 6 23:57:03 2018 +0900

    Remove indexing for mysql. with_legacy_artifacts targets all archive rows. Enhance tests.

commit 696c030d4a1ae2e1ee5e0eac771e574191fcb477
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Jun 6 19:59:35 2018 +0900

    Fix static analysys. Split methods. Use `file_types`

commit 86217c650c99d86d5b329229799f250f2ac5fbf6
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Jun 6 18:55:15 2018 +0900

    Use raw sql for better readability

commit df449404cb167edd61af1e59ca24f25db0a9ca9f
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Jun 6 17:47:39 2018 +0900

    Revert unneccesary change

commit 764977a1d98b34e34fcd229fca72c9595d62861a
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Jun 6 16:09:14 2018 +0900

    Remove AddIndexToCiBuildsArtifactsFile. Add temporary index in background migration class.

commit 7728ab3f9dba0af21033e1ca3b0213cacaef85d8
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Jun 6 15:28:50 2018 +0900

    Try to explicitly separate with postgresql and mysql for addin index

commit b95b47b965413f6590bd7eb38e34b4ef88cd2002
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Jun 6 14:29:18 2018 +0900

    Dry up code by referring `BackgroundMigration` namespace. Use `BETWEEN` raw SQL to make the edge case explicit.

commit 5b404e46e2a7c0d5a49b9745a8d985a80c9e380a
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Jun 6 14:15:37 2018 +0900

    Use `store_path` to make spec more explicit

commit 9f80de8e5aed49aae148278b0d27273e92ddbf25
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Jun 6 14:03:26 2018 +0900

    Use length not limit

commit f78503f3e55cc08d78274767b9381631201262e0
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Jun 6 13:48:51 2018 +0900

    Add length back for indexing

commit b96a57d5e5c7d2a97a1926ec95d67f0a2a1b8c93
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue Jun 5 12:42:14 2018 +0000

    Update schema.rb

commit 9c25acc9752e5cf87f4062dc9f33fb609e8fb7be
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue Jun 5 12:40:48 2018 +0000

    Add the guard clause in #down method too

commit 2bd5dadbd1b742d15bfb0914ad1be7e2182c1755
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue Jun 5 19:41:08 2018 +0900

    Add a gurad caluse to block adding concurrent index for mysql

commit 9a5e12768ed30f75dd796d7c70f54b5e78aaa746
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue Jun 5 19:20:33 2018 +0900

    Specify length of index in schema.rb manually for resolving mysql errors

commit c0ec68af02706d3c01b20b9f589113a900ff2071
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue Jun 5 17:51:40 2018 +0900

    Separate add_concurrent_index by database type

commit b5f4ed37d9f49719fd8235a7069bb93f3c73c2dc
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue Jun 5 17:30:19 2018 +0900

    Fix length size to use TEXT

commit b38b56056f4de384e32ee9acfbf161397de079fd
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue Jun 5 17:20:35 2018 +0900

    Fix schema version for background migration spec

commit 32c48ef7cba61ceb285c6c7c1f48964a204dff20
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue Jun 5 16:22:00 2018 +0900

    Specify length of indexed column. (This is neccessary for TEXT type)

commit a2e975f2e610ffd5f7f400b29a77d6b337005f1d
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue Jun 5 15:13:42 2018 +0900

    Fix spec; migrate_legacy_artifacts_to_job_artifacts_spec.rb

commit c78c1e3f127b947e46a007bec2d56e0f3a55d7fa
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Mon Jun 4 20:15:23 2018 +0900

    Separate add_concurrent_index migration from background migration

commit ad55e33bc2cd622b19f78ace64a69c18870d62df
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Mon Jun 4 19:59:14 2018 +0900

    Revert "Remove index_exists? guard"

    This reverts commit d76807838cf06e023b608c16426174a752a8ccf5.

commit b2693be76fb2d643058f7f0fffd0d75ef13c38f0
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Mon Jun 4 17:11:47 2018 +0900

    Remove index_exists? guard

commit a2eb053d3b3bd8c8ad49958d58b7225658214a72
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Mon Jun 4 15:41:54 2018 +0900

    Wrap insertion and deletion in a single transaction

commit d4bb2c709ce549eb5d7382c03390bfdf6ec90297
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Mon Jun 4 15:08:17 2018 +0900

    Add temporary index to ci_builds.artifacts_file to speed up SELECT query

commit 33d62be9ee72a5ee4a61a7bc793df84ea7e85730
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Mon May 28 17:31:38 2018 +0900

    Add test for legacy path proxy

commit 57ab71a05b464dc4f477837f237eb15e8e51bb84
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Mon May 28 15:59:36 2018 +0900

    Optimize queries. Add some tests for filtering logic.

commit 8f24dfaac70bc564973bd81745b80421f1a3e1af
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Mon May 28 15:30:38 2018 +0900

    Fix static analysis

commit ccc60ddd6076f997f63f46cad814e4ac9e4cbdfc
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Thu May 24 16:51:59 2018 +0900

    Add changelog

commit fdbdb07a40a8343e8292e618f90658e77cc2115e
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Thu May 24 16:50:55 2018 +0900

    Add spec for migrations

commit 04886af8724258f9971798adcf3eacd5716f20df
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Thu May 24 14:48:31 2018 +0900

    Revise comments

commit 55bcbee0576b5ac08b4ed461b85d059e0c670159
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Thu May 24 14:40:29 2018 +0900

    Revise comments

commit db6628675abfe24cc10e682a65bf87ca02504deb
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue May 15 17:27:12 2018 +0900

    Add spec base (Not finished)

commit e92dcc392eb4ad5aac06a3510a5879a3f084b9ee
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue May 15 17:26:49 2018 +0900

    Added artifacts_metadata_store to remove in background migration

commit 91388399d80b58a831b21e6582d5f5ab29e785c7
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue May 15 17:26:20 2018 +0900

    Add a condition to exclude jobs which have job_artifacts already

commit e084ce1181d07d0799714eee058d6c9182bc2fcf
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue May 15 16:51:15 2018 +0900

    Clean up migrate_legacy_artifacts.rb (Fix static analysys)

commit ca4e5d33e27690dc276ba87d08dc24bcf31267f4
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue May 15 16:32:59 2018 +0900

    Remove the culcuration method of metadata size

commit eac4c75be932ae6936702ddfd9202f333f18053f
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue May 15 16:11:16 2018 +0900

    Remove Gitlab::BackgroundMigration:: scope

commit 4a5ca96b628a59eeba25778569e719695ac8b5e8
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue May 15 16:09:09 2018 +0900

    Add limit to file_location column

commit 49ff3d9c98dc145fe3c91cd8ba39d7d71d183fb7
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue May 15 16:05:22 2018 +0900

    Use size.to_i instead of if-condition

commit 526656e6ee5683ec7ea07bd6af3438c3fc32375d
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue May 15 16:02:57 2018 +0900

    Rename current_path to hashed_path

commit 8e6faca7900cf382a35323b2ed0fabede9bf3bf9
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue May 8 16:53:43 2018 +0900

    Rename location_1/2 to current/legacy_path

commit 5034543255963a250e076f37c5e42fbf4cb0fd05
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue May 1 21:44:10 2018 +0900

    Rename path_type to file_location. Fix JobArtifactUploader to look up correct file location.

commit 4f7e3503f13d02d7a70e7b68bf740a8d8bb525db
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Fri Apr 27 17:33:15 2018 +0900

    Add background migration for legacy artifacts

Add default_value_for to file_location column

Set file_location explicityly with default_values_for

Add file_location to factory

Remove tests of default_values_for

Set file_location nil as default
2018-08-27 09:12:02 +02:00
..
active_record Replace 'Sidekiq::Testing.inline!' with 'perform_enqueued_jobs' 2018-07-23 15:34:54 +11:00
add_foreign_key_from_notification_settings_to_users_spec.rb Resolve "Remove ghost notification settings for groups and projects" 2018-08-02 09:34:44 +00:00
add_foreign_key_to_merge_requests_spec.rb Use batching to clear orphans in head_pipeline migration 2017-07-18 12:07:12 +02:00
add_foreign_keys_to_todos_spec.rb Ignore current RSpec/FactoriesInMigrationSpecs offenses 2018-04-06 17:41:52 +02:00
add_head_pipeline_for_each_merge_request_spec.rb Ignore current RSpec/FactoriesInMigrationSpecs offenses 2018-04-06 17:41:52 +02:00
add_not_null_constraint_to_project_mirror_data_foreign_key_spec.rb Adds not null constraint to ProjectMirrorData's foreign_key project_id 2018-05-08 11:25:12 +01:00
add_pipeline_build_foreign_key_spec.rb Remove orphaned builds without project / pipeline reference 2018-05-08 17:12:29 +02:00
add_unique_constraint_to_project_features_project_id_spec.rb Add a unique and not null constraint on the project_features.project_id column 2018-05-15 14:20:14 +02:00
assure_commits_count_for_merge_request_diff_spec.rb Cleanup after adding MR diff's commit_count (try 2) 2018-04-25 10:53:37 +02:00
calculate_conv_dev_index_percentages_spec.rb Ignore current RSpec/FactoriesInMigrationSpecs offenses 2018-04-06 17:41:52 +02:00
change_default_value_for_dsa_key_restriction_spec.rb Add migration to disable the usage of DSA keys 2018-06-04 23:00:25 -05:00
clean_appearance_symlinks_spec.rb Merge branch 'bvl-remove-appearance-symlink' into 'security-9-3' 2017-07-19 22:28:17 -05:00
clean_stage_id_reference_migration_spec.rb Fix background migration cleanup specs 2017-07-20 10:53:52 +02:00
clean_stages_statuses_migration_spec.rb Make sure all stages are migrated after a cleanup 2017-09-18 13:47:46 +02:00
clean_up_for_members_spec.rb Fix user membership destroy relation 2018-01-02 15:06:44 +00:00
clean_upload_symlinks_spec.rb Update migrations to move directly into the -/system folder 2017-08-11 18:15:02 +02:00
cleanup_build_stage_migration_spec.rb Cleanup pipeline build stage background migration 2018-05-07 14:38:11 +02:00
cleanup_move_system_upload_folder_symlink_spec.rb Move the uploads/system folder to uploads/-/system 2017-07-18 15:38:54 +02:00
cleanup_namespaceless_pending_delete_projects_spec.rb Ignore current RSpec/FactoriesInMigrationSpecs offenses 2018-04-06 17:41:52 +02:00
cleanup_nonexisting_namespace_pending_delete_projects_spec.rb Ignore current RSpec/FactoriesInMigrationSpecs offenses 2018-04-06 17:41:52 +02:00
cleanup_stages_position_migration_spec.rb Add pipeline stages position clean-up migration 2018-06-29 13:57:52 +00:00
convert_custom_notification_settings_to_columns_spec.rb Reset column information after the schema is migrated in MigrationsHelpers.schema_migrate_up! 2018-02-07 11:38:50 +01:00
create_missing_namespace_for_internal_users_spec.rb Fix missing namespace for some internal users 2018-04-20 17:53:22 -05:00
delete_conflicting_redirect_routes_spec.rb Make DeleteConflictingRedirectRoutes no-op 2018-01-03 12:23:20 -08:00
delete_inconsistent_internal_id_records_spec.rb Add migration to cleanup internal_ids. 2018-08-17 11:38:53 +02:00
drop_duplicate_protected_tags_spec.rb API: Protected tags 2018-08-25 05:38:54 +00:00
enqueue_delete_diff_files_workers_spec.rb Use schedulers and delete diff files upon deadtuples check 2018-07-10 10:25:48 -03:00
enqueue_verify_pages_domain_workers_spec.rb Add DNS verification to Pages custom domains 2018-02-23 12:22:29 +00:00
fill_file_store_spec.rb Add spec for fill_file_store migration 2018-05-28 14:50:10 +09:00
fix_wrongly_renamed_routes_spec.rb Use the DatabaseCleaner 'deletion' strategy instead of 'truncation' 2018-01-24 17:25:55 +00:00
generate_missing_routes_spec.rb Remove code for dynamically generating routes 2018-07-25 16:41:29 +02:00
issues_moved_to_id_foreign_key_spec.rb Updates from rubocop -a 2018-07-09 21:13:08 +08:00
migrate_build_stage_reference_again_spec.rb Rename stage ref migration specs to match a class name 2017-06-21 15:51:00 +02:00
migrate_create_trace_artifact_sidekiq_queue_spec.rb Fix tests by latest proposal changes 2018-03-06 21:44:15 +09:00
migrate_gcp_clusters_to_new_clusters_architectures_spec.rb Resolve Naming/UncommunicativeMethod 2018-07-09 21:13:08 +08:00
migrate_import_attributes_data_from_projects_to_project_mirror_data_spec.rb Backports every CE related change from ee-44542 to CE 2018-05-04 17:33:26 +02:00
migrate_issues_to_ghost_user_spec.rb Update specs to respect Project#namespace_id not null constraint 2018-03-01 16:09:09 +02:00
migrate_kubernetes_service_to_new_clusters_architectures_spec.rb Fix static analysys 2018-01-08 17:01:29 +09:00
migrate_legacy_artifacts_to_job_artifacts_spec.rb Squashed commit of the following: 2018-08-27 09:12:02 +02:00
migrate_null_wiki_access_levels_spec.rb Add WikiAccessLevel migration from NULL to 20 2018-08-16 19:58:17 +02:00
migrate_object_storage_upload_sidekiq_queue_spec.rb Migrate jobs in object_storage_upload queue 2018-06-05 20:37:01 +02:00
migrate_old_artifacts_spec.rb Ignore current RSpec/FactoriesInMigrationSpecs offenses 2018-04-06 17:41:52 +02:00
migrate_pipeline_sidekiq_queues_spec.rb Migrate new jobs when reverting pipeline queues migration 2017-08-25 14:25:18 +02:00
migrate_pipeline_stages_spec.rb Migrate stages only with correct foreign references 2017-06-06 14:32:24 +02:00
migrate_process_commit_worker_jobs_spec.rb Remove direct disk access in RemoveDotGitFromUsernames 2018-07-19 15:19:45 +02:00
migrate_remaining_mr_metrics_populating_background_migration_spec.rb Take two for MR metrics population background migration 2018-05-30 11:51:29 -03:00
migrate_stage_id_reference_in_background_spec.rb Replace 'Sidekiq::Testing.inline!' with 'perform_enqueued_jobs' 2018-07-23 15:34:54 +11:00
migrate_stages_statuses_spec.rb Replace 'Sidekiq::Testing.inline!' with 'perform_enqueued_jobs' 2018-07-23 15:34:54 +11:00
migrate_update_head_pipeline_for_merge_request_sidekiq_queue_spec.rb Move update_head_pipeline_for_merge_request queue to pipeline_processing namespace 2018-03-07 01:39:00 +09:00
migrate_user_activities_to_users_last_activity_on_spec.rb Ignore current RSpec/FactoriesInMigrationSpecs offenses 2018-04-06 17:41:52 +02:00
migrate_user_authentication_token_to_personal_access_token_spec.rb Migrate user private tokens to personal access tokens 2017-11-02 11:39:03 +01:00
migrate_user_project_view_spec.rb Ignore current RSpec/FactoriesInMigrationSpecs offenses 2018-04-06 17:41:52 +02:00
move_personal_snippets_files_spec.rb Ignore current RSpec/FactoriesInMigrationSpecs offenses 2018-04-06 17:41:52 +02:00
move_system_upload_folder_spec.rb Update migrations to move directly into the -/system folder 2017-08-11 18:15:02 +02:00
move_uploads_to_system_dir_spec.rb Update migrations to move directly into the -/system folder 2017-08-11 18:15:02 +02:00
normalize_ldap_extern_uids_spec.rb Fix interval in NormalizeLdapExternUids spec 2018-08-06 15:20:37 +02:00
populate_can_push_from_deploy_keys_projects_spec.rb Applied fix 2018-01-17 21:42:18 +01:00
README.md Avoid dropping tables in test 2018-02-14 12:31:16 +01:00
remove_assignee_id_from_issue_spec.rb Add spec for removing issues.assignee_id 2017-12-11 14:09:55 +00:00
remove_dot_git_from_usernames_spec.rb Ignore current RSpec/FactoriesInMigrationSpecs offenses 2018-04-06 17:41:52 +02:00
remove_duplicate_mr_events_spec.rb Ignore current RSpec/FactoriesInMigrationSpecs offenses 2018-04-06 17:41:52 +02:00
remove_empty_extern_uid_auth0_identities_spec.rb Merge branch 'fix/auth0-unsafe-login-10-6' into 'security-10-6' 2018-03-21 14:43:47 +00:00
remove_empty_fork_networks_spec.rb Merge commit '8af23def1d6' into object-storage-ee-to-ce-backport 2018-02-28 21:11:53 +01:00
remove_project_labels_group_id_spec.rb Ignore current RSpec/FactoriesInMigrationSpecs offenses 2018-04-06 17:41:52 +02:00
remove_redundant_pipeline_stages_spec.rb Add more specs for unique stages index migration 2018-02-06 09:58:50 +01:00
remove_soft_removed_objects_spec.rb Bring CE-EE parity to migrations/remove_soft_removed_objects_spec.rb 2018-06-18 12:18:02 -05:00
rename_duplicated_variable_key_spec.rb Rename the migration test to match the migration path 2017-06-27 18:29:23 +08:00
rename_more_reserved_project_names_spec.rb Ignore current RSpec/FactoriesInMigrationSpecs offenses 2018-04-06 17:41:52 +02:00
rename_reserved_project_names_spec.rb Ignore current RSpec/FactoriesInMigrationSpecs offenses 2018-04-06 17:41:52 +02:00
rename_users_with_renamed_namespace_spec.rb Ignore current RSpec/FactoriesInMigrationSpecs offenses 2018-04-06 17:41:52 +02:00
reschedule_builds_stages_migration_spec.rb Update entities in pipeline stages migration test 2018-04-05 12:08:04 +02:00
reschedule_commits_count_for_merge_request_diff_spec.rb Reschedule commits_count background migration 2018-03-09 09:56:49 +01:00
schedule_create_gpg_key_subkeys_from_gpg_keys_spec.rb Whitelist existing destroy_all offenses 2018-08-16 17:29:37 +02:00
schedule_merge_request_diff_migrations_spec.rb Replace 'Sidekiq::Testing.inline!' with 'perform_enqueued_jobs' 2018-07-23 15:34:54 +11:00
schedule_merge_request_diff_migrations_take_two_spec.rb Replace 'Sidekiq::Testing.inline!' with 'perform_enqueued_jobs' 2018-07-23 15:34:54 +11:00
schedule_merge_request_latest_merge_request_diff_id_migrations_spec.rb Replace 'Sidekiq::Testing.inline!' with 'perform_enqueued_jobs' 2018-07-23 15:34:54 +11:00
schedule_populate_merge_request_metrics_with_events_data_spec.rb Ignore current RSpec/FactoriesInMigrationSpecs offenses 2018-04-06 17:41:52 +02:00
schedule_set_confidential_note_events_on_webhooks_spec.rb Replace 'Sidekiq::Testing.inline!' with 'perform_enqueued_jobs' 2018-07-23 15:34:54 +11:00
schedule_stages_index_migration_spec.rb Use stages position column to track stage index 2018-05-01 14:30:44 +02:00
schedule_to_archive_legacy_traces_spec.rb Fix specs. Rename migration file name which was conflicted with background migration's. 2018-06-04 14:14:20 +09:00
track_untracked_uploads_spec.rb Move TrackUntrackedUploadsHelpers 2018-02-20 12:09:50 -08:00
turn_nested_groups_into_regular_groups_for_mysql_spec.rb Deny repository disk access in development and test 2018-06-14 11:18:25 +00:00
update_legacy_diff_notes_type_for_import_spec.rb Fix notes type created from import 2017-09-29 11:18:58 +00:00
update_notes_type_for_import_spec.rb Fix notes type created from import 2017-09-29 11:18:58 +00:00
update_retried_for_ci_build_spec.rb Ignore current RSpec/FactoriesInMigrationSpecs offenses 2018-04-06 17:41:52 +02:00
update_upload_paths_to_system_spec.rb Fix spec/migrations/update_upload_paths_to_system_spec.rb to use the :migration metadata 2018-01-18 12:17:22 +01:00

Testing migrations

In order to reliably test a migration, we need to test it against a database schema that this migration has been written for. In order to achieve that we have some migration helpers and RSpec test tag, called :migration.

If you want to write a test for a migration consider adding :migration tag to the test signature, like describe SomeMigrationClass, :migration.

How does it work?

Adding a :migration tag to a test signature injects a few before / after hooks to the test.

The most important change is that adding a :migration tag adds a before hook that will revert all migrations to the point that a migration under test is not yet migrated.

In other words, our custom RSpec hooks will find a previous migration, and migrate the database down to the previous migration version.

With this approach you can test a migration against a database schema that this migration has been written for.

Use migrate! helper to run the migration that is under test.

The after hook will migrate the database up and reinstitutes the latest schema version, so that the process does not affect subsequent specs and ensures proper isolation.

Testing a class that is not an ActiveRecord::Migration

In order to test a class that is not a migration itself, you will need to manually provide a required schema version. Please add a schema tag to a context that you want to switch the database schema within.

Example: describe SomeClass, :migration, schema: 20170608152748.

Available helpers

Use table helper to create a temporary ActiveRecord::Base derived model for a table.

Use migrate! helper to run the migration that is under test. It will not only run migration, but will also bump the schema version in the schema_migrations table. It is necessary because in the after hook we trigger the rest of the migrations, and we need to know where to start.

See spec/support/migrations_helpers.rb for all the available helpers.

An example

require 'spec_helper'

# Load a migration class.

require Rails.root.join('db', 'post_migrate', '20170526185842_migrate_pipeline_stages.rb')

describe MigratePipelineStages, :migration do

  # Create test data - pipeline and CI/CD jobs.

  let(:jobs) { table(:ci_builds) }
  let(:stages) { table(:ci_stages) }
  let(:pipelines) { table(:ci_pipelines) }
  let(:projects) { table(:projects) }

  before do
    projects.create!(id: 123, name: 'gitlab1', path: 'gitlab1')
    pipelines.create!(id: 1, project_id: 123, ref: 'master', sha: 'adf43c3a')
    jobs.create!(id: 1, commit_id: 1, project_id: 123, stage_idx: 2, stage: 'build')
    jobs.create!(id: 2, commit_id: 1, project_id: 123, stage_idx: 1, stage: 'test')
  end

  # Test the migration.

  it 'correctly migrates pipeline stages' do
    expect(stages.count).to be_zero

    migrate!

    expect(stages.count).to eq 2
    expect(stages.all.pluck(:name)).to match_array %w[test build]
  end
end

Best practices

  1. Note that this type of tests do not run within the transaction, we use a deletion database cleanup strategy. Do not depend on transaction being present.