diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-24 03:11:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-24 03:11:30 +0300 |
commit | 1dd92924325105bb04d8900ac2577e59eb39f603 (patch) | |
tree | 0639fdc40eb357eb3fab79155e1e59076fbc1cec /db | |
parent | a0686b4653208e66c768b63e249bd73406f9e267 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/docs/project_ci_cd_settings.yml | 2 | ||||
-rw-r--r-- | db/docs/project_compliance_standards_adherence.yml | 2 | ||||
-rw-r--r-- | db/docs/project_group_links.yml | 2 | ||||
-rw-r--r-- | db/docs/project_import_data.yml | 2 | ||||
-rw-r--r-- | db/docs/project_pages_metadata.yml | 2 | ||||
-rw-r--r-- | db/docs/project_security_settings.yml | 2 | ||||
-rw-r--r-- | db/docs/project_settings.yml | 2 | ||||
-rw-r--r-- | db/docs/project_statistics.yml | 2 | ||||
-rw-r--r-- | db/docs/project_wiki_repositories.yml | 2 | ||||
-rw-r--r-- | db/docs/projects_sync_events.yml | 2 | ||||
-rw-r--r-- | db/docs/push_rules.yml | 2 | ||||
-rw-r--r-- | db/post_migrate/20231019003052_swap_columns_for_ci_pipelines_pipeline_id_bigint_v2.rb | 60 | ||||
-rw-r--r-- | db/schema_migrations/20231019003052 | 1 | ||||
-rw-r--r-- | db/structure.sql | 4 |
14 files changed, 74 insertions, 13 deletions
diff --git a/db/docs/project_ci_cd_settings.yml b/db/docs/project_ci_cd_settings.yml index 265ec896247..0f7f59dbb15 100644 --- a/db/docs/project_ci_cd_settings.yml +++ b/db/docs/project_ci_cd_settings.yml @@ -9,4 +9,4 @@ feature_categories: description: Project-scoped settings related to the CI/CD domain introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/392c411bdc16386ef42c86afaf8c4d8e4cddb955 milestone: '10.8' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/project_compliance_standards_adherence.yml b/db/docs/project_compliance_standards_adherence.yml index c2f08e9f82c..78fbf8a8a46 100644 --- a/db/docs/project_compliance_standards_adherence.yml +++ b/db/docs/project_compliance_standards_adherence.yml @@ -7,4 +7,4 @@ feature_categories: description: Stores the details about projects and their adherence to compliance standards introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/122293 milestone: '16.1' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/project_group_links.yml b/db/docs/project_group_links.yml index aa981adb745..927fc05bf2a 100644 --- a/db/docs/project_group_links.yml +++ b/db/docs/project_group_links.yml @@ -7,4 +7,4 @@ feature_categories: description: TODO introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/3ac5a759e93e632539438d4564582c645a9f6799 milestone: "<6.0" -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/project_import_data.yml b/db/docs/project_import_data.yml index 283657a1dd3..d0ea6a3f2bc 100644 --- a/db/docs/project_import_data.yml +++ b/db/docs/project_import_data.yml @@ -7,4 +7,4 @@ feature_categories: description: Used to store credentials and configuration of external projects when using the Import/Export feature introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/7d98c8842d6bc9b14fb410f028db7ab651961b42 milestone: '7.10' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/project_pages_metadata.yml b/db/docs/project_pages_metadata.yml index d9b609d7784..e0d70015784 100644 --- a/db/docs/project_pages_metadata.yml +++ b/db/docs/project_pages_metadata.yml @@ -7,4 +7,4 @@ feature_categories: description: Store GitLab Pages metadata for projects. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/17197 milestone: '12.4' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/project_security_settings.yml b/db/docs/project_security_settings.yml index af559d11164..dd098aef0bc 100644 --- a/db/docs/project_security_settings.yml +++ b/db/docs/project_security_settings.yml @@ -8,4 +8,4 @@ feature_categories: description: Project settings related to security features. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/32577 milestone: '13.1' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/project_settings.yml b/db/docs/project_settings.yml index 63e96e34dc5..d9b1c68a0b9 100644 --- a/db/docs/project_settings.yml +++ b/db/docs/project_settings.yml @@ -7,4 +7,4 @@ feature_categories: description: Stores settings per project introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/a2a7ad291f64a5db74c1bc21fb556e6e8862d0f3 milestone: '10.8' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/project_statistics.yml b/db/docs/project_statistics.yml index 9bc6175b45f..a9d47be3bb4 100644 --- a/db/docs/project_statistics.yml +++ b/db/docs/project_statistics.yml @@ -7,4 +7,4 @@ feature_categories: description: Records statistics about the usage of various product features introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/7754 milestone: '8.16' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/project_wiki_repositories.yml b/db/docs/project_wiki_repositories.yml index 7da09b7fffe..666b76aa498 100644 --- a/db/docs/project_wiki_repositories.yml +++ b/db/docs/project_wiki_repositories.yml @@ -7,4 +7,4 @@ feature_categories: description: Stores information about project wiki repositories. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/103399 milestone: '15.6' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/projects_sync_events.yml b/db/docs/projects_sync_events.yml index 84b99fe6080..aca4b407902 100644 --- a/db/docs/projects_sync_events.yml +++ b/db/docs/projects_sync_events.yml @@ -7,4 +7,4 @@ feature_categories: description: Used as a queue of data that needs to be synchronized between the `ci` and `main` database introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75517 milestone: '14.6' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/docs/push_rules.yml b/db/docs/push_rules.yml index 85c609719b6..1579268a9bb 100644 --- a/db/docs/push_rules.yml +++ b/db/docs/push_rules.yml @@ -7,4 +7,4 @@ feature_categories: description: TODO introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/1b98b5ab97ce3e9997df542059cbf3c6ce0bf0e1 milestone: '8.10' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell diff --git a/db/post_migrate/20231019003052_swap_columns_for_ci_pipelines_pipeline_id_bigint_v2.rb b/db/post_migrate/20231019003052_swap_columns_for_ci_pipelines_pipeline_id_bigint_v2.rb new file mode 100644 index 00000000000..4065bad5fb5 --- /dev/null +++ b/db/post_migrate/20231019003052_swap_columns_for_ci_pipelines_pipeline_id_bigint_v2.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +class SwapColumnsForCiPipelinesPipelineIdBigintV2 < Gitlab::Database::Migration[2.1] + include Gitlab::Database::MigrationHelpers::WraparoundAutovacuum + include Gitlab::Database::MigrationHelpers::Swapping + + disable_ddl_transaction! + + TABLE_NAME = :ci_pipelines + TRIGGER_FUNCTION_NAME = :trigger_1bd97da9c1a4 + COLUMN_NAME = :auto_canceled_by_id + BIGINT_COLUMN_NAME = :auto_canceled_by_id_convert_to_bigint + FK_NAME = :fk_262d4c2d19 + BIGINT_FK_NAME = :fk_67e4288f3a + INDEX_NAME = :index_ci_pipelines_on_auto_canceled_by_id + BIGINT_INDEX_NAME = :index_ci_pipelines_on_auto_canceled_by_id_bigint + + def up + return if should_skip? || column_type_of?(:bigint) + + swap + end + + def down + return if should_skip? || column_type_of?(:integer) + + swap + end + + private + + def should_skip? + !can_execute_on?(TABLE_NAME) + end + + def column_type_of?(type) + column_for(TABLE_NAME, COLUMN_NAME).sql_type.to_s == type.to_s + end + + def swap + # rubocop:disable Migration/WithLockRetriesDisallowedMethod + with_lock_retries(raise_on_exhaustion: true) do + # Lock the tables involved. + lock_tables(TABLE_NAME) + + # Rename the columns to swap names + swap_columns(TABLE_NAME, COLUMN_NAME, BIGINT_COLUMN_NAME) + + # Reset the trigger function + reset_trigger_function(TRIGGER_FUNCTION_NAME) + + # Swap fkey constraint + swap_foreign_keys(TABLE_NAME, FK_NAME, BIGINT_FK_NAME) + + # Swap index + swap_indexes(TABLE_NAME, INDEX_NAME, BIGINT_INDEX_NAME) + end + # rubocop:enable Migration/WithLockRetriesDisallowedMethod + end +end diff --git a/db/schema_migrations/20231019003052 b/db/schema_migrations/20231019003052 new file mode 100644 index 00000000000..c12f6d1a9a5 --- /dev/null +++ b/db/schema_migrations/20231019003052 @@ -0,0 +1 @@ +baa0d627f26ff5d2cb773f724bc08eca03b80f59553f6706388429194844b5dc
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index a565ca74b01..09c8974b20e 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -13944,7 +13944,7 @@ CREATE TABLE ci_pipelines ( duration integer, user_id integer, lock_version integer DEFAULT 0, - auto_canceled_by_id integer, + auto_canceled_by_id_convert_to_bigint integer, pipeline_schedule_id integer, source integer, config_source integer, @@ -13959,7 +13959,7 @@ CREATE TABLE ci_pipelines ( locked smallint DEFAULT 1 NOT NULL, partition_id bigint NOT NULL, id_convert_to_bigint bigint DEFAULT 0 NOT NULL, - auto_canceled_by_id_convert_to_bigint bigint, + auto_canceled_by_id bigint, CONSTRAINT check_d7e99a025e CHECK ((lock_version IS NOT NULL)) ); |