diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-16 09:09:15 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-16 09:09:15 +0000 |
commit | b7b44de429911864686599ef1643baf525bf75ec (patch) | |
tree | 5c066cff07a9900bbc4c1907b0563857b4361b40 /db | |
parent | 06bcbc77e472a70b8332150a941539c55953ef2b (diff) | |
download | gitlab-ce-b7b44de429911864686599ef1643baf525bf75ec.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
13 files changed, 161 insertions, 1 deletions
diff --git a/db/migrate/20220523030804_add_web_hook_calls_med_and_max_to_plan_limits.rb b/db/migrate/20220523030804_add_web_hook_calls_med_and_max_to_plan_limits.rb new file mode 100644 index 00000000000..c1ed306551f --- /dev/null +++ b/db/migrate/20220523030804_add_web_hook_calls_med_and_max_to_plan_limits.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +class AddWebHookCallsMedAndMaxToPlanLimits < Gitlab::Database::Migration[2.0] + def change + add_column :plan_limits, :web_hook_calls_mid, :integer, null: false, default: 0 + add_column :plan_limits, :web_hook_calls_low, :integer, null: false, default: 0 + end +end diff --git a/db/migrate/20220523030805_add_web_hook_calls_to_plan_limits_paid_tiers.rb b/db/migrate/20220523030805_add_web_hook_calls_to_plan_limits_paid_tiers.rb new file mode 100644 index 00000000000..842bb297803 --- /dev/null +++ b/db/migrate/20220523030805_add_web_hook_calls_to_plan_limits_paid_tiers.rb @@ -0,0 +1,81 @@ +# frozen_string_literal: true + +class AddWebHookCallsToPlanLimitsPaidTiers < Gitlab::Database::Migration[2.0] + restrict_gitlab_migration gitlab_schema: :gitlab_main + + MAX_RATE_LIMIT_NAME = 'web_hook_calls' + MID_RATE_LIMIT_NAME = 'web_hook_calls_mid' + MIN_RATE_LIMIT_NAME = 'web_hook_calls_low' + + UP_FREE_LIMITS = { + MAX_RATE_LIMIT_NAME => 500, + MID_RATE_LIMIT_NAME => 500, + MIN_RATE_LIMIT_NAME => 500 + }.freeze + + UP_PREMIUM_LIMITS = { + MAX_RATE_LIMIT_NAME => 4_000, + MID_RATE_LIMIT_NAME => 2_800, + MIN_RATE_LIMIT_NAME => 1_600 + }.freeze + + UP_ULTIMATE_LIMITS = { + MAX_RATE_LIMIT_NAME => 13_000, + MID_RATE_LIMIT_NAME => 9_000, + MIN_RATE_LIMIT_NAME => 6_000 + }.freeze + + DOWN_FREE_LIMITS = { + # 120 is the value for 'free' migrated in `db/migrate/20210601131742_update_web_hook_calls_limit.rb` + MAX_RATE_LIMIT_NAME => 120, + MID_RATE_LIMIT_NAME => 0, + MIN_RATE_LIMIT_NAME => 0 + }.freeze + + DOWN_PAID_LIMITS = { + MAX_RATE_LIMIT_NAME => 0, + MID_RATE_LIMIT_NAME => 0, + MIN_RATE_LIMIT_NAME => 0 + }.freeze + + def up + return unless Gitlab.com? + + apply_limits('free', UP_FREE_LIMITS) + + # Apply Premium limits + apply_limits('bronze', UP_PREMIUM_LIMITS) + apply_limits('silver', UP_PREMIUM_LIMITS) + apply_limits('premium', UP_PREMIUM_LIMITS) + apply_limits('premium_trial', UP_PREMIUM_LIMITS) + + # Apply Ultimate limits + apply_limits('gold', UP_ULTIMATE_LIMITS) + apply_limits('ultimate', UP_ULTIMATE_LIMITS) + apply_limits('ultimate_trial', UP_ULTIMATE_LIMITS) + apply_limits('opensource', UP_ULTIMATE_LIMITS) + end + + def down + return unless Gitlab.com? + + apply_limits('free', DOWN_FREE_LIMITS) + + apply_limits('bronze', DOWN_PAID_LIMITS) + apply_limits('silver', DOWN_PAID_LIMITS) + apply_limits('premium', DOWN_PAID_LIMITS) + apply_limits('premium_trial', DOWN_PAID_LIMITS) + apply_limits('gold', DOWN_PAID_LIMITS) + apply_limits('ultimate', DOWN_PAID_LIMITS) + apply_limits('ultimate_trial', DOWN_PAID_LIMITS) + apply_limits('opensource', DOWN_PAID_LIMITS) + end + + private + + def apply_limits(plan_name, limits) + limits.each_pair do |limit_name, limit| + create_or_update_plan_limit(limit_name, plan_name, limit) + end + end +end diff --git a/db/migrate/20220530104431_add_timestamps_to_compliance_frameworks.rb b/db/migrate/20220530104431_add_timestamps_to_compliance_frameworks.rb new file mode 100644 index 00000000000..88013fddc81 --- /dev/null +++ b/db/migrate/20220530104431_add_timestamps_to_compliance_frameworks.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddTimestampsToComplianceFrameworks < Gitlab::Database::Migration[2.0] + def up + add_column :compliance_management_frameworks, :created_at, :datetime_with_timezone, null: true + add_column :compliance_management_frameworks, :updated_at, :datetime_with_timezone, null: true + end + + def down + remove_column :compliance_management_frameworks, :created_at + remove_column :compliance_management_frameworks, :updated_at + end +end diff --git a/db/migrate/20220614095912_add_has_vulnerabilities_to_cluster_agents.rb b/db/migrate/20220614095912_add_has_vulnerabilities_to_cluster_agents.rb new file mode 100644 index 00000000000..e4e4e3ab7ae --- /dev/null +++ b/db/migrate/20220614095912_add_has_vulnerabilities_to_cluster_agents.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddHasVulnerabilitiesToClusterAgents < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + add_column :cluster_agents, :has_vulnerabilities, :boolean, default: false, null: false + end +end diff --git a/db/migrate/20220615091059_add_created_at_index_to_compliance_management_frameworks.rb b/db/migrate/20220615091059_add_created_at_index_to_compliance_management_frameworks.rb new file mode 100644 index 00000000000..a930dde9a83 --- /dev/null +++ b/db/migrate/20220615091059_add_created_at_index_to_compliance_management_frameworks.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddCreatedAtIndexToComplianceManagementFrameworks < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = "i_compliance_frameworks_on_id_and_created_at" + + def up + add_concurrent_index :compliance_management_frameworks, + [:id, :created_at, :pipeline_configuration_full_path], + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :compliance_management_frameworks, INDEX_NAME + end +end diff --git a/db/migrate/20220615105811_add_index_on_clusters_agent_project_id_and_has_vulnerabilities_columns.rb b/db/migrate/20220615105811_add_index_on_clusters_agent_project_id_and_has_vulnerabilities_columns.rb new file mode 100644 index 00000000000..007f36c26ed --- /dev/null +++ b/db/migrate/20220615105811_add_index_on_clusters_agent_project_id_and_has_vulnerabilities_columns.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexOnClustersAgentProjectIdAndHasVulnerabilitiesColumns < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'index_cluster_agents_on_project_id_and_has_vulnerabilities' + + def up + add_concurrent_index :cluster_agents, + [:project_id, :has_vulnerabilities], + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :cluster_agents, INDEX_NAME + end +end diff --git a/db/schema_migrations/20220523030804 b/db/schema_migrations/20220523030804 new file mode 100644 index 00000000000..6a9bdd4f66d --- /dev/null +++ b/db/schema_migrations/20220523030804 @@ -0,0 +1 @@ +80535374849c10d41663d339b95b9ffddbec9b40a8af4585c18602cbe92c14d1
\ No newline at end of file diff --git a/db/schema_migrations/20220523030805 b/db/schema_migrations/20220523030805 new file mode 100644 index 00000000000..3714e71a3f3 --- /dev/null +++ b/db/schema_migrations/20220523030805 @@ -0,0 +1 @@ +92a7ed079521ccb8ab04e59826947778c37bccd30d47f1b0e29727f769e3ff32
\ No newline at end of file diff --git a/db/schema_migrations/20220530104431 b/db/schema_migrations/20220530104431 new file mode 100644 index 00000000000..4e809f44d25 --- /dev/null +++ b/db/schema_migrations/20220530104431 @@ -0,0 +1 @@ +f49e691c46ddaaf1b18d95726e7c2473fab946ea79885727ba09bb92591e4a01
\ No newline at end of file diff --git a/db/schema_migrations/20220614095912 b/db/schema_migrations/20220614095912 new file mode 100644 index 00000000000..e84b4a2fb3d --- /dev/null +++ b/db/schema_migrations/20220614095912 @@ -0,0 +1 @@ +96d899efc1fa39cf3433987ee4d8062456f7a6af6248b97eda2ddc5491dcf7f5
\ No newline at end of file diff --git a/db/schema_migrations/20220615091059 b/db/schema_migrations/20220615091059 new file mode 100644 index 00000000000..1d1b35fc8f6 --- /dev/null +++ b/db/schema_migrations/20220615091059 @@ -0,0 +1 @@ +bbfcaf59734b67142b237b7ea479c5eaa3c2152cdd84c87ad541e5a0e75466ef
\ No newline at end of file diff --git a/db/schema_migrations/20220615105811 b/db/schema_migrations/20220615105811 new file mode 100644 index 00000000000..e2ada7879b8 --- /dev/null +++ b/db/schema_migrations/20220615105811 @@ -0,0 +1 @@ +33456ce3af299e010011b1346b4097ffa1ee642ffb90d342ea22171c3f079d7a
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index fb9bbd72aa8..a3f5ece22b9 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -13346,6 +13346,7 @@ CREATE TABLE cluster_agents ( project_id bigint NOT NULL, name text NOT NULL, created_by_user_id bigint, + has_vulnerabilities boolean DEFAULT false NOT NULL, CONSTRAINT check_3498369510 CHECK ((char_length(name) <= 255)) ); @@ -13795,6 +13796,8 @@ CREATE TABLE compliance_management_frameworks ( color text NOT NULL, namespace_id integer NOT NULL, pipeline_configuration_full_path text, + created_at timestamp with time zone, + updated_at timestamp with time zone, CONSTRAINT check_08cd34b2c2 CHECK ((char_length(color) <= 10)), CONSTRAINT check_1617e0b87e CHECK ((char_length(description) <= 255)), CONSTRAINT check_ab00bc2193 CHECK ((char_length(name) <= 255)), @@ -18780,7 +18783,9 @@ CREATE TABLE plan_limits ( pipeline_triggers integer DEFAULT 25000 NOT NULL, project_ci_secure_files integer DEFAULT 100 NOT NULL, repository_size bigint DEFAULT 0 NOT NULL, - security_policy_scan_execution_schedules integer DEFAULT 0 NOT NULL + security_policy_scan_execution_schedules integer DEFAULT 0 NOT NULL, + web_hook_calls_mid integer DEFAULT 0 NOT NULL, + web_hook_calls_low integer DEFAULT 0 NOT NULL ); CREATE SEQUENCE plan_limits_id_seq @@ -26767,6 +26772,8 @@ CREATE INDEX i_batched_background_migration_job_transition_logs_on_job_id ON ONL CREATE UNIQUE INDEX i_ci_job_token_project_scope_links_on_source_and_target_project ON ci_job_token_project_scope_links USING btree (source_project_id, target_project_id); +CREATE INDEX i_compliance_frameworks_on_id_and_created_at ON compliance_management_frameworks USING btree (id, created_at, pipeline_configuration_full_path); + CREATE INDEX idx_analytics_devops_adoption_segments_on_namespace_id ON analytics_devops_adoption_segments USING btree (namespace_id); CREATE INDEX idx_analytics_devops_adoption_snapshots_finalized ON analytics_devops_adoption_snapshots USING btree (namespace_id, end_time) WHERE (recorded_at >= end_time); @@ -27543,6 +27550,8 @@ CREATE UNIQUE INDEX index_cluster_agent_tokens_on_token_encrypted ON cluster_age CREATE INDEX index_cluster_agents_on_created_by_user_id ON cluster_agents USING btree (created_by_user_id); +CREATE INDEX index_cluster_agents_on_project_id_and_has_vulnerabilities ON cluster_agents USING btree (project_id, has_vulnerabilities); + CREATE UNIQUE INDEX index_cluster_agents_on_project_id_and_name ON cluster_agents USING btree (project_id, name); CREATE UNIQUE INDEX index_cluster_enabled_grants_on_namespace_id ON cluster_enabled_grants USING btree (namespace_id); |