From 2defb483df8cd5647ec27754fe63bb92fb73c681 Mon Sep 17 00:00:00 2001 From: Carla Drago Date: Tue, 5 Jul 2022 17:00:52 +0200 Subject: [PATCH 1/8] Add import_creation_level to namespace settings This migration adds a new column to the namespace_settings table. This column will keep track of the level required of a user to be able to import into a group. The default value is 0, which maps to the OWNER role. Changelog: added --- ...rt_creation_level_to_namespace_settings.rb | 27 ++++ db/schema_migrations/20220705145349 | 1 + db/structure.sql | 141 +++++++++--------- 3 files changed, 99 insertions(+), 70 deletions(-) create mode 100644 db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb create mode 100644 db/schema_migrations/20220705145349 diff --git a/db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb b/db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb new file mode 100644 index 00000000000000..3ebcc4ad87131d --- /dev/null +++ b/db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# See https://docs.gitlab.com/ee/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddImportCreationLevelToNamespaceSettings < Gitlab::Database::Migration[2.0] + # When using the methods "add_concurrent_index" or "remove_concurrent_index" + # you must disable the use of transactions + # as these methods can not run in an existing transaction. + # When using "add_concurrent_index" or "remove_concurrent_index" methods make sure + # that either of them is the _only_ method called in the migration, + # any other changes should go in a separate migration. + # This ensures that upon failure _only_ the index creation or removing fails + # and can be retried or reverted easily. + # + # To disable transactions uncomment the following line and remove these + # comments: + # disable_ddl_transaction! + # + # Configure the `gitlab_schema` to perform data manipulation (DML). + # Visit: https://docs.gitlab.com/ee/development/database/migrations_for_multiple_databases.html + # restrict_gitlab_migration gitlab_schema: :gitlab_main + + def change + add_column :namespace_settings, :import_creation_level, :integer, default: 1 + end +end diff --git a/db/schema_migrations/20220705145349 b/db/schema_migrations/20220705145349 new file mode 100644 index 00000000000000..6c309d401db890 --- /dev/null +++ b/db/schema_migrations/20220705145349 @@ -0,0 +1 @@ +7f5288a47ce5d548bf47fbcd107e31f5448ec1d730ce5b13a760c155c50b44fb \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index fb278f182b78ce..980b2dd0fdf2c1 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -231,26 +231,6 @@ RETURN NULL; END $$; -CREATE TABLE audit_events ( - id bigint NOT NULL, - author_id integer NOT NULL, - entity_id integer NOT NULL, - entity_type character varying NOT NULL, - details text, - ip_address inet, - author_name text, - entity_path text, - target_details text, - created_at timestamp without time zone NOT NULL, - target_type text, - target_id bigint, - CONSTRAINT check_492aaa021d CHECK ((char_length(entity_path) <= 5500)), - CONSTRAINT check_83ff8406e2 CHECK ((char_length(author_name) <= 255)), - CONSTRAINT check_97a8c868e7 CHECK ((char_length(target_type) <= 255)), - CONSTRAINT check_d493ec90b5 CHECK ((char_length(target_details) <= 5500)) -) -PARTITION BY RANGE (created_at); - CREATE TABLE batched_background_migration_job_transition_logs ( id bigint NOT NULL, batched_background_migration_job_id bigint NOT NULL, @@ -265,26 +245,6 @@ CREATE TABLE batched_background_migration_job_transition_logs ( ) PARTITION BY RANGE (created_at); -CREATE TABLE incident_management_pending_alert_escalations ( - id bigint NOT NULL, - rule_id bigint NOT NULL, - alert_id bigint NOT NULL, - process_at timestamp with time zone NOT NULL, - created_at timestamp with time zone NOT NULL, - updated_at timestamp with time zone NOT NULL -) -PARTITION BY RANGE (process_at); - -CREATE TABLE incident_management_pending_issue_escalations ( - id bigint NOT NULL, - rule_id bigint NOT NULL, - issue_id bigint NOT NULL, - process_at timestamp with time zone NOT NULL, - created_at timestamp with time zone NOT NULL, - updated_at timestamp with time zone NOT NULL -) -PARTITION BY RANGE (process_at); - CREATE TABLE loose_foreign_keys_deleted_records ( id bigint NOT NULL, partition bigint DEFAULT 1 NOT NULL, @@ -298,36 +258,6 @@ CREATE TABLE loose_foreign_keys_deleted_records ( ) PARTITION BY LIST (partition); -CREATE TABLE verification_codes ( - created_at timestamp with time zone DEFAULT now() NOT NULL, - visitor_id_code text NOT NULL, - code text NOT NULL, - phone text NOT NULL, - CONSTRAINT check_9b84e6aaff CHECK ((char_length(code) <= 8)), - CONSTRAINT check_ccc542256b CHECK ((char_length(visitor_id_code) <= 64)), - CONSTRAINT check_f5684c195b CHECK ((char_length(phone) <= 50)) -) -PARTITION BY RANGE (created_at); - -COMMENT ON TABLE verification_codes IS 'JiHu-specific table'; - -CREATE TABLE web_hook_logs ( - id bigint NOT NULL, - web_hook_id integer NOT NULL, - trigger character varying, - url character varying, - request_headers text, - request_data text, - response_headers text, - response_body text, - response_status character varying, - execution_duration double precision, - internal_error_message character varying, - updated_at timestamp without time zone NOT NULL, - created_at timestamp without time zone NOT NULL -) -PARTITION BY RANGE (created_at); - CREATE TABLE analytics_cycle_analytics_issue_stage_events ( stage_event_hash_id bigint NOT NULL, issue_id bigint NOT NULL, @@ -11647,6 +11577,26 @@ CREATE SEQUENCE atlassian_identities_user_id_seq ALTER SEQUENCE atlassian_identities_user_id_seq OWNED BY atlassian_identities.user_id; +CREATE TABLE audit_events ( + id bigint NOT NULL, + author_id integer NOT NULL, + entity_id integer NOT NULL, + entity_type character varying NOT NULL, + details text, + ip_address inet, + author_name text, + entity_path text, + target_details text, + created_at timestamp without time zone NOT NULL, + target_type text, + target_id bigint, + CONSTRAINT check_492aaa021d CHECK ((char_length(entity_path) <= 5500)), + CONSTRAINT check_83ff8406e2 CHECK ((char_length(author_name) <= 255)), + CONSTRAINT check_97a8c868e7 CHECK ((char_length(target_type) <= 255)), + CONSTRAINT check_d493ec90b5 CHECK ((char_length(target_details) <= 5500)) +) +PARTITION BY RANGE (created_at); + CREATE TABLE audit_events_external_audit_event_destinations ( id bigint NOT NULL, namespace_id bigint NOT NULL, @@ -16169,6 +16119,16 @@ CREATE SEQUENCE incident_management_oncall_shifts_id_seq ALTER SEQUENCE incident_management_oncall_shifts_id_seq OWNED BY incident_management_oncall_shifts.id; +CREATE TABLE incident_management_pending_alert_escalations ( + id bigint NOT NULL, + rule_id bigint NOT NULL, + alert_id bigint NOT NULL, + process_at timestamp with time zone NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL +) +PARTITION BY RANGE (process_at); + CREATE SEQUENCE incident_management_pending_alert_escalations_id_seq START WITH 1 INCREMENT BY 1 @@ -16178,6 +16138,16 @@ CREATE SEQUENCE incident_management_pending_alert_escalations_id_seq ALTER SEQUENCE incident_management_pending_alert_escalations_id_seq OWNED BY incident_management_pending_alert_escalations.id; +CREATE TABLE incident_management_pending_issue_escalations ( + id bigint NOT NULL, + rule_id bigint NOT NULL, + issue_id bigint NOT NULL, + process_at timestamp with time zone NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL +) +PARTITION BY RANGE (process_at); + CREATE SEQUENCE incident_management_pending_issue_escalations_id_seq START WITH 1 INCREMENT BY 1 @@ -17554,6 +17524,7 @@ CREATE TABLE namespace_settings ( enabled_git_access_protocol smallint DEFAULT 0 NOT NULL, unique_project_download_limit smallint DEFAULT 0 NOT NULL, unique_project_download_limit_interval_in_seconds integer DEFAULT 0 NOT NULL, + import_creation_level integer DEFAULT 1, CONSTRAINT check_0ba93c78c7 CHECK ((char_length(default_branch_name) <= 255)) ); @@ -21898,6 +21869,19 @@ CREATE SEQUENCE users_statistics_id_seq ALTER SEQUENCE users_statistics_id_seq OWNED BY users_statistics.id; +CREATE TABLE verification_codes ( + created_at timestamp with time zone DEFAULT now() NOT NULL, + visitor_id_code text NOT NULL, + code text NOT NULL, + phone text NOT NULL, + CONSTRAINT check_9b84e6aaff CHECK ((char_length(code) <= 8)), + CONSTRAINT check_ccc542256b CHECK ((char_length(visitor_id_code) <= 64)), + CONSTRAINT check_f5684c195b CHECK ((char_length(phone) <= 50)) +) +PARTITION BY RANGE (created_at); + +COMMENT ON TABLE verification_codes IS 'JiHu-specific table'; + CREATE TABLE vulnerabilities ( id bigint NOT NULL, milestone_id bigint, @@ -22381,6 +22365,23 @@ CREATE SEQUENCE vulnerability_user_mentions_id_seq ALTER SEQUENCE vulnerability_user_mentions_id_seq OWNED BY vulnerability_user_mentions.id; +CREATE TABLE web_hook_logs ( + id bigint NOT NULL, + web_hook_id integer NOT NULL, + trigger character varying, + url character varying, + request_headers text, + request_data text, + response_headers text, + response_body text, + response_status character varying, + execution_duration double precision, + internal_error_message character varying, + updated_at timestamp without time zone NOT NULL, + created_at timestamp without time zone NOT NULL +) +PARTITION BY RANGE (created_at); + CREATE SEQUENCE web_hook_logs_id_seq START WITH 1 INCREMENT BY 1 -- GitLab From e381a4e643e4a09eb2e8f106fd7733f3038161a3 Mon Sep 17 00:00:00 2001 From: Carla Drago Date: Tue, 5 Jul 2022 17:48:17 +0200 Subject: [PATCH 2/8] Remove automated comment from migration file --- ...rt_creation_level_to_namespace_settings.rb | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb b/db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb index 3ebcc4ad87131d..45074c84c2be8e 100644 --- a/db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb +++ b/db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb @@ -1,26 +1,6 @@ # frozen_string_literal: true -# See https://docs.gitlab.com/ee/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - class AddImportCreationLevelToNamespaceSettings < Gitlab::Database::Migration[2.0] - # When using the methods "add_concurrent_index" or "remove_concurrent_index" - # you must disable the use of transactions - # as these methods can not run in an existing transaction. - # When using "add_concurrent_index" or "remove_concurrent_index" methods make sure - # that either of them is the _only_ method called in the migration, - # any other changes should go in a separate migration. - # This ensures that upon failure _only_ the index creation or removing fails - # and can be retried or reverted easily. - # - # To disable transactions uncomment the following line and remove these - # comments: - # disable_ddl_transaction! - # - # Configure the `gitlab_schema` to perform data manipulation (DML). - # Visit: https://docs.gitlab.com/ee/development/database/migrations_for_multiple_databases.html - # restrict_gitlab_migration gitlab_schema: :gitlab_main - def change add_column :namespace_settings, :import_creation_level, :integer, default: 1 end -- GitLab From 53ce0e1642e5fe9ac11b7a90fd986e4025e644a9 Mon Sep 17 00:00:00 2001 From: Carla Drago Date: Tue, 5 Jul 2022 19:20:18 +0200 Subject: [PATCH 3/8] Fix structure.sql file manually --- db/structure.sql | 140 +++++++++++++++++++++++------------------------ 1 file changed, 70 insertions(+), 70 deletions(-) diff --git a/db/structure.sql b/db/structure.sql index 980b2dd0fdf2c1..1f713267710b18 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -231,6 +231,26 @@ RETURN NULL; END $$; +CREATE TABLE audit_events ( + id bigint NOT NULL, + author_id integer NOT NULL, + entity_id integer NOT NULL, + entity_type character varying NOT NULL, + details text, + ip_address inet, + author_name text, + entity_path text, + target_details text, + created_at timestamp without time zone NOT NULL, + target_type text, + target_id bigint, + CONSTRAINT check_492aaa021d CHECK ((char_length(entity_path) <= 5500)), + CONSTRAINT check_83ff8406e2 CHECK ((char_length(author_name) <= 255)), + CONSTRAINT check_97a8c868e7 CHECK ((char_length(target_type) <= 255)), + CONSTRAINT check_d493ec90b5 CHECK ((char_length(target_details) <= 5500)) +) +PARTITION BY RANGE (created_at); + CREATE TABLE batched_background_migration_job_transition_logs ( id bigint NOT NULL, batched_background_migration_job_id bigint NOT NULL, @@ -245,6 +265,26 @@ CREATE TABLE batched_background_migration_job_transition_logs ( ) PARTITION BY RANGE (created_at); +CREATE TABLE incident_management_pending_alert_escalations ( + id bigint NOT NULL, + rule_id bigint NOT NULL, + alert_id bigint NOT NULL, + process_at timestamp with time zone NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL +) +PARTITION BY RANGE (process_at); + +CREATE TABLE incident_management_pending_issue_escalations ( + id bigint NOT NULL, + rule_id bigint NOT NULL, + issue_id bigint NOT NULL, + process_at timestamp with time zone NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL +) +PARTITION BY RANGE (process_at); + CREATE TABLE loose_foreign_keys_deleted_records ( id bigint NOT NULL, partition bigint DEFAULT 1 NOT NULL, @@ -258,6 +298,36 @@ CREATE TABLE loose_foreign_keys_deleted_records ( ) PARTITION BY LIST (partition); +CREATE TABLE verification_codes ( + created_at timestamp with time zone DEFAULT now() NOT NULL, + visitor_id_code text NOT NULL, + code text NOT NULL, + phone text NOT NULL, + CONSTRAINT check_9b84e6aaff CHECK ((char_length(code) <= 8)), + CONSTRAINT check_ccc542256b CHECK ((char_length(visitor_id_code) <= 64)), + CONSTRAINT check_f5684c195b CHECK ((char_length(phone) <= 50)) +) +PARTITION BY RANGE (created_at); + +COMMENT ON TABLE verification_codes IS 'JiHu-specific table'; + +CREATE TABLE web_hook_logs ( + id bigint NOT NULL, + web_hook_id integer NOT NULL, + trigger character varying, + url character varying, + request_headers text, + request_data text, + response_headers text, + response_body text, + response_status character varying, + execution_duration double precision, + internal_error_message character varying, + updated_at timestamp without time zone NOT NULL, + created_at timestamp without time zone NOT NULL +) +PARTITION BY RANGE (created_at); + CREATE TABLE analytics_cycle_analytics_issue_stage_events ( stage_event_hash_id bigint NOT NULL, issue_id bigint NOT NULL, @@ -11577,26 +11647,6 @@ CREATE SEQUENCE atlassian_identities_user_id_seq ALTER SEQUENCE atlassian_identities_user_id_seq OWNED BY atlassian_identities.user_id; -CREATE TABLE audit_events ( - id bigint NOT NULL, - author_id integer NOT NULL, - entity_id integer NOT NULL, - entity_type character varying NOT NULL, - details text, - ip_address inet, - author_name text, - entity_path text, - target_details text, - created_at timestamp without time zone NOT NULL, - target_type text, - target_id bigint, - CONSTRAINT check_492aaa021d CHECK ((char_length(entity_path) <= 5500)), - CONSTRAINT check_83ff8406e2 CHECK ((char_length(author_name) <= 255)), - CONSTRAINT check_97a8c868e7 CHECK ((char_length(target_type) <= 255)), - CONSTRAINT check_d493ec90b5 CHECK ((char_length(target_details) <= 5500)) -) -PARTITION BY RANGE (created_at); - CREATE TABLE audit_events_external_audit_event_destinations ( id bigint NOT NULL, namespace_id bigint NOT NULL, @@ -16119,16 +16169,6 @@ CREATE SEQUENCE incident_management_oncall_shifts_id_seq ALTER SEQUENCE incident_management_oncall_shifts_id_seq OWNED BY incident_management_oncall_shifts.id; -CREATE TABLE incident_management_pending_alert_escalations ( - id bigint NOT NULL, - rule_id bigint NOT NULL, - alert_id bigint NOT NULL, - process_at timestamp with time zone NOT NULL, - created_at timestamp with time zone NOT NULL, - updated_at timestamp with time zone NOT NULL -) -PARTITION BY RANGE (process_at); - CREATE SEQUENCE incident_management_pending_alert_escalations_id_seq START WITH 1 INCREMENT BY 1 @@ -16138,16 +16178,6 @@ CREATE SEQUENCE incident_management_pending_alert_escalations_id_seq ALTER SEQUENCE incident_management_pending_alert_escalations_id_seq OWNED BY incident_management_pending_alert_escalations.id; -CREATE TABLE incident_management_pending_issue_escalations ( - id bigint NOT NULL, - rule_id bigint NOT NULL, - issue_id bigint NOT NULL, - process_at timestamp with time zone NOT NULL, - created_at timestamp with time zone NOT NULL, - updated_at timestamp with time zone NOT NULL -) -PARTITION BY RANGE (process_at); - CREATE SEQUENCE incident_management_pending_issue_escalations_id_seq START WITH 1 INCREMENT BY 1 @@ -21869,19 +21899,6 @@ CREATE SEQUENCE users_statistics_id_seq ALTER SEQUENCE users_statistics_id_seq OWNED BY users_statistics.id; -CREATE TABLE verification_codes ( - created_at timestamp with time zone DEFAULT now() NOT NULL, - visitor_id_code text NOT NULL, - code text NOT NULL, - phone text NOT NULL, - CONSTRAINT check_9b84e6aaff CHECK ((char_length(code) <= 8)), - CONSTRAINT check_ccc542256b CHECK ((char_length(visitor_id_code) <= 64)), - CONSTRAINT check_f5684c195b CHECK ((char_length(phone) <= 50)) -) -PARTITION BY RANGE (created_at); - -COMMENT ON TABLE verification_codes IS 'JiHu-specific table'; - CREATE TABLE vulnerabilities ( id bigint NOT NULL, milestone_id bigint, @@ -22365,23 +22382,6 @@ CREATE SEQUENCE vulnerability_user_mentions_id_seq ALTER SEQUENCE vulnerability_user_mentions_id_seq OWNED BY vulnerability_user_mentions.id; -CREATE TABLE web_hook_logs ( - id bigint NOT NULL, - web_hook_id integer NOT NULL, - trigger character varying, - url character varying, - request_headers text, - request_data text, - response_headers text, - response_body text, - response_status character varying, - execution_duration double precision, - internal_error_message character varying, - updated_at timestamp without time zone NOT NULL, - created_at timestamp without time zone NOT NULL -) -PARTITION BY RANGE (created_at); - CREATE SEQUENCE web_hook_logs_id_seq START WITH 1 INCREMENT BY 1 -- GitLab From 6f91ba8df4266fa7671ac5ac45b671f3d80c4a52 Mon Sep 17 00:00:00 2001 From: Carla Drago Date: Tue, 5 Jul 2022 20:09:14 +0200 Subject: [PATCH 4/8] Change default to owner level --- ...705145349_add_import_creation_level_to_namespace_settings.rb | 2 +- db/structure.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb b/db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb index 45074c84c2be8e..fe45bae6a3dfa0 100644 --- a/db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb +++ b/db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb @@ -2,6 +2,6 @@ class AddImportCreationLevelToNamespaceSettings < Gitlab::Database::Migration[2.0] def change - add_column :namespace_settings, :import_creation_level, :integer, default: 1 + add_column :namespace_settings, :import_creation_level, :integer, default: 0 end end diff --git a/db/structure.sql b/db/structure.sql index 1f713267710b18..64c2927ffdb317 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -17554,7 +17554,7 @@ CREATE TABLE namespace_settings ( enabled_git_access_protocol smallint DEFAULT 0 NOT NULL, unique_project_download_limit smallint DEFAULT 0 NOT NULL, unique_project_download_limit_interval_in_seconds integer DEFAULT 0 NOT NULL, - import_creation_level integer DEFAULT 1, + import_creation_level integer DEFAULT 0, CONSTRAINT check_0ba93c78c7 CHECK ((char_length(default_branch_name) <= 255)) ); -- GitLab From 80fe54525eec5dbf946b4339176b81b014d97b48 Mon Sep 17 00:00:00 2001 From: Tiger Watson Date: Wed, 6 Jul 2022 01:14:57 +0000 Subject: [PATCH 5/8] Use smallint and not null --- ...705145349_add_import_creation_level_to_namespace_settings.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb b/db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb index fe45bae6a3dfa0..2bc9162de81784 100644 --- a/db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb +++ b/db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb @@ -2,6 +2,6 @@ class AddImportCreationLevelToNamespaceSettings < Gitlab::Database::Migration[2.0] def change - add_column :namespace_settings, :import_creation_level, :integer, default: 0 + add_column :namespace_settings, :import_creation_level, :smallint, default: 0, null: false end end -- GitLab From 89673c13e3b7615bbb199d25e2c44a597d7e4dc9 Mon Sep 17 00:00:00 2001 From: Tiger Watson Date: Wed, 6 Jul 2022 01:15:36 +0000 Subject: [PATCH 6/8] Enable lock retries to table --- ...705145349_add_import_creation_level_to_namespace_settings.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb b/db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb index 2bc9162de81784..01ca7efe24ad93 100644 --- a/db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb +++ b/db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class AddImportCreationLevelToNamespaceSettings < Gitlab::Database::Migration[2.0] + enable_lock_retries! + def change add_column :namespace_settings, :import_creation_level, :smallint, default: 0, null: false end -- GitLab From 56920ae6cfccaac3babd9fe06b586bd4b0bd5bfa Mon Sep 17 00:00:00 2001 From: Carla Drago Date: Wed, 6 Jul 2022 03:19:59 +0200 Subject: [PATCH 7/8] Update structure.sql manually --- db/structure.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/structure.sql b/db/structure.sql index 64c2927ffdb317..02992d1c5dd03a 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -17554,7 +17554,7 @@ CREATE TABLE namespace_settings ( enabled_git_access_protocol smallint DEFAULT 0 NOT NULL, unique_project_download_limit smallint DEFAULT 0 NOT NULL, unique_project_download_limit_interval_in_seconds integer DEFAULT 0 NOT NULL, - import_creation_level integer DEFAULT 0, + import_creation_level smallint DEFAULT 0 NOT NULL, CONSTRAINT check_0ba93c78c7 CHECK ((char_length(default_branch_name) <= 255)) ); -- GitLab From da2855159514ea29e14072d352aa1a3fb0d4487d Mon Sep 17 00:00:00 2001 From: Carla Drago Date: Wed, 6 Jul 2022 12:09:52 +0200 Subject: [PATCH 8/8] Add project import level to group settings This migration adds a new column to the namespace_settings table to keep track of the level required of a user for importing projects into a group. The default value is 0, which maps to the OWNER role. Changelog: added --- ...49_add_import_creation_level_to_namespace_settings.rb | 9 --------- ...349_add_project_import_level_to_namespace_settings.rb | 9 +++++++++ db/structure.sql | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) delete mode 100644 db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb create mode 100644 db/migrate/20220705145349_add_project_import_level_to_namespace_settings.rb diff --git a/db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb b/db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb deleted file mode 100644 index 01ca7efe24ad93..00000000000000 --- a/db/migrate/20220705145349_add_import_creation_level_to_namespace_settings.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddImportCreationLevelToNamespaceSettings < Gitlab::Database::Migration[2.0] - enable_lock_retries! - - def change - add_column :namespace_settings, :import_creation_level, :smallint, default: 0, null: false - end -end diff --git a/db/migrate/20220705145349_add_project_import_level_to_namespace_settings.rb b/db/migrate/20220705145349_add_project_import_level_to_namespace_settings.rb new file mode 100644 index 00000000000000..e46f0221782e4f --- /dev/null +++ b/db/migrate/20220705145349_add_project_import_level_to_namespace_settings.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddProjectImportLevelToNamespaceSettings < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + add_column :namespace_settings, :project_import_level, :smallint, default: 0, null: false + end +end diff --git a/db/structure.sql b/db/structure.sql index 02992d1c5dd03a..64640eb098db6c 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -17554,7 +17554,7 @@ CREATE TABLE namespace_settings ( enabled_git_access_protocol smallint DEFAULT 0 NOT NULL, unique_project_download_limit smallint DEFAULT 0 NOT NULL, unique_project_download_limit_interval_in_seconds integer DEFAULT 0 NOT NULL, - import_creation_level smallint DEFAULT 0 NOT NULL, + project_import_level smallint DEFAULT 0 NOT NULL, CONSTRAINT check_0ba93c78c7 CHECK ((char_length(default_branch_name) <= 255)) ); -- GitLab