Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
8cc4a6f23d
commit
99bd45e7ce
|
|
@ -187,7 +187,7 @@ rspec fast_spec_helper:
|
|||
db:rollback:
|
||||
extends: .db-job-base
|
||||
script:
|
||||
- scripts/db_tasks db:migrate VERSION=20210301200959
|
||||
- scripts/db_tasks db:migrate VERSION=20210602155110
|
||||
- scripts/db_tasks db:migrate SKIP_SCHEMA_VERSION_CHECK=true
|
||||
|
||||
db:rollback single-db:
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ The changes need to become an official part of the product.
|
|||
- [ ] Determine whether the feature should apply to EE - and which tiers - and/or Core
|
||||
- [ ] Determine if tracking should be kept as is, removed, or modified.
|
||||
- [ ] Ensure any relevant documentation has been updated.
|
||||
- [ ] Determine whether there are other concerns that need to be considered before removing the feature flag.
|
||||
- These are typically captured in the `Experiment Successful Cleanup Concerns` section of the rollout issue.
|
||||
- [ ] Consider changes to any `feature_category:` introduced by the experiment if ownership is changing (PM for Growth and PM for the new category as DRIs)
|
||||
- [ ] Check to see if the experiment introduced new design assets. Add them to the appropriate repos and document them if needed.
|
||||
- [ ] Optional: Migrate experiment to a default enabled [feature flag](https://docs.gitlab.com/ee/development/feature_flags) for one milestone and add a changelog. Converting to a feature flag can be skipped at the ICs discretion if risk is deemed low with consideration to both SaaS and (if applicable) self managed
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
522c0d9283f757583fcfd43e66b4d5b323503bc0
|
||||
5ac19c65a70ffe94d1cc52232f2f23071e782cef
|
||||
|
|
|
|||
|
|
@ -240,7 +240,10 @@
|
|||
]
|
||||
},
|
||||
"coverage_report": {
|
||||
"type": "object",
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"description": "Used to collect coverage reports from the job.",
|
||||
"properties": {
|
||||
"coverage_format": {
|
||||
|
|
|
|||
|
|
@ -531,7 +531,7 @@ export const getOverlappingDaysInPeriods = (givenPeriodLeft = {}, givenPeriodRig
|
|||
|
||||
/**
|
||||
* Mimics the behaviour of the rails distance_of_time_in_words function
|
||||
* https://api.rubyonrails.org/v6.0.1/classes/ActionView/Helpers/DateHelper.html#method-i-distance_of_time_in_words
|
||||
* https://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#method-i-distance_of_time_in_words
|
||||
* 0 < -> 29 secs => less than a minute
|
||||
* 30 secs < -> 1 min, 29 secs => 1 minute
|
||||
* 1 min, 30 secs < -> 44 mins, 29 secs => [2..44] minutes
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export default {
|
|||
GlDropdownItem,
|
||||
LdapDropdownItem: () => import('ee_component/members/components/ldap/ldap_dropdown_item.vue'),
|
||||
},
|
||||
inject: ['namespace'],
|
||||
inject: ['namespace', 'group'],
|
||||
props: {
|
||||
member: {
|
||||
type: Object,
|
||||
|
|
@ -32,7 +32,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
disabled() {
|
||||
return this.busy || (this.permissions.canOverride && !this.member.isOverridden);
|
||||
return this.permissions.canOverride && !this.member.isOverridden;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
|
|
@ -52,21 +52,29 @@ export default {
|
|||
return dispatch(`${this.namespace}/updateMemberRole`, payload);
|
||||
},
|
||||
}),
|
||||
async handleOverageConfirm(currentAccessLevel, value) {
|
||||
async handleOverageConfirm(currentRoleValue, newRoleValue, newRoleName) {
|
||||
return guestOverageConfirmAction({
|
||||
currentAccessIntValue: currentAccessLevel,
|
||||
dropdownIntValue: value,
|
||||
currentRoleValue,
|
||||
newRoleValue,
|
||||
newRoleName,
|
||||
group: this.group,
|
||||
memberId: this.member.id,
|
||||
memberType: this.namespace,
|
||||
});
|
||||
},
|
||||
async handleSelect(value, name) {
|
||||
const currentAccessLevel = this.member.accessLevel.integerValue;
|
||||
if (value === currentAccessLevel) {
|
||||
async handleSelect(newRoleValue, newRoleName) {
|
||||
const currentRoleValue = this.member.accessLevel.integerValue;
|
||||
if (newRoleValue === currentRoleValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.busy = true;
|
||||
|
||||
const confirmed = await this.handleOverageConfirm(currentAccessLevel, value);
|
||||
const confirmed = await this.handleOverageConfirm(
|
||||
currentRoleValue,
|
||||
newRoleValue,
|
||||
newRoleName,
|
||||
);
|
||||
if (!confirmed) {
|
||||
this.busy = false;
|
||||
return;
|
||||
|
|
@ -74,7 +82,7 @@ export default {
|
|||
|
||||
this.updateMemberRole({
|
||||
memberId: this.member.id,
|
||||
accessLevel: { integerValue: value, stringValue: name },
|
||||
accessLevel: { integerValue: newRoleValue, stringValue: newRoleName },
|
||||
})
|
||||
.then(() => {
|
||||
this.$toast.show(s__('Members|Role updated successfully.'));
|
||||
|
|
@ -97,6 +105,7 @@ export default {
|
|||
:text="member.accessLevel.stringValue"
|
||||
:header-text="__('Change role')"
|
||||
:disabled="disabled"
|
||||
:loading="busy"
|
||||
>
|
||||
<gl-dropdown-item
|
||||
v-for="(value, name) in member.validRoles"
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ export const initMembersApp = (el, options) => {
|
|||
canExportMembers,
|
||||
canFilterByEnterprise,
|
||||
exportCsvPath,
|
||||
groupName,
|
||||
groupPath,
|
||||
...vuexStoreAttributes
|
||||
} = parseDataAttributes(el);
|
||||
|
||||
|
|
@ -66,6 +68,10 @@ export const initMembersApp = (el, options) => {
|
|||
canFilterByEnterprise,
|
||||
canExportMembers,
|
||||
exportCsvPath,
|
||||
group: {
|
||||
name: groupName,
|
||||
path: groupPath,
|
||||
},
|
||||
},
|
||||
render: (createElement) => createElement('members-tabs'),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ class Import::BulkImportsController < ApplicationController
|
|||
session[access_token_key] = configure_params[access_token_key]&.strip
|
||||
session[url_key] = configure_params[url_key]
|
||||
|
||||
verify_blocked_uri && performed? && return
|
||||
validate_configure_params!
|
||||
|
||||
redirect_to status_import_bulk_imports_url(namespace_id: params[:namespace_id])
|
||||
end
|
||||
|
||||
|
|
@ -100,6 +103,16 @@ class Import::BulkImportsController < ApplicationController
|
|||
params.permit(access_token_key, url_key)
|
||||
end
|
||||
|
||||
def validate_configure_params!
|
||||
client = BulkImports::Clients::HTTP.new(
|
||||
url: credentials[:url],
|
||||
token: credentials[:access_token]
|
||||
)
|
||||
|
||||
client.validate_instance_version!
|
||||
client.validate_import_scopes!
|
||||
end
|
||||
|
||||
def create_params
|
||||
params.permit(bulk_import: bulk_import_params)[:bulk_import]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -13,7 +13,9 @@ module Groups::GroupMembersHelper
|
|||
access_request: group_members_list_data(group, access_requests.nil? ? [] : access_requests),
|
||||
source_id: group.id,
|
||||
can_manage_members: can?(current_user, :admin_group_member, group),
|
||||
can_manage_access_requests: can?(current_user, :admin_member_access_request, group)
|
||||
can_manage_access_requests: can?(current_user, :admin_member_access_request, group),
|
||||
group_name: group.name,
|
||||
group_path: group.full_path
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -35,18 +35,6 @@ module IssuesHelper
|
|||
end
|
||||
end
|
||||
|
||||
def status_box_variant(item)
|
||||
if item.try(:expired?)
|
||||
'warning'
|
||||
elsif item.closed?
|
||||
'danger'
|
||||
elsif item.try(:upcoming?)
|
||||
'neutral'
|
||||
else
|
||||
'success'
|
||||
end
|
||||
end
|
||||
|
||||
def issue_status_visibility(issue, status_box:)
|
||||
case status_box
|
||||
when :open
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@ module Projects::ProjectMembersHelper
|
|||
access_request: project_members_list_data(project, access_requests.nil? ? [] : access_requests),
|
||||
source_id: project.id,
|
||||
can_manage_members: Ability.allowed?(current_user, :admin_project_member, project),
|
||||
can_manage_access_requests: Ability.allowed?(current_user, :admin_member_access_request, project)
|
||||
can_manage_access_requests: Ability.allowed?(current_user, :admin_member_access_request, project),
|
||||
group_name: project.group&.name,
|
||||
group_path: project.group&.full_path
|
||||
}.to_json
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,18 @@ module TimeboxesHelper
|
|||
end
|
||||
end
|
||||
|
||||
def milestone_badge_variant(milestone)
|
||||
if milestone.closed?
|
||||
:danger
|
||||
elsif milestone.expired?
|
||||
:warning
|
||||
elsif milestone.upcoming?
|
||||
:neutral
|
||||
else
|
||||
:success
|
||||
end
|
||||
end
|
||||
|
||||
def milestones_filter_path(opts = {})
|
||||
if @project
|
||||
project_milestones_path(@project, opts)
|
||||
|
|
|
|||
|
|
@ -11,17 +11,12 @@ class Namespace < ApplicationRecord
|
|||
include FeatureGate
|
||||
include FromUnion
|
||||
include Gitlab::Utils::StrongMemoize
|
||||
include IgnorableColumns
|
||||
include Namespaces::Traversal::Recursive
|
||||
include Namespaces::Traversal::Linear
|
||||
include EachBatch
|
||||
include BlocksUnsafeSerialization
|
||||
include Ci::NamespaceSettings
|
||||
|
||||
# Temporary column used for back-filling project namespaces.
|
||||
# Remove it once the back-filling of all project namespaces is done.
|
||||
ignore_column :tmp_project_id, remove_with: '14.7', remove_after: '2022-01-22'
|
||||
|
||||
# Tells ActiveRecord not to store the full class name, in order to save some space
|
||||
# https://gitlab.com/gitlab-org/gitlab/-/merge_requests/69794
|
||||
self.store_full_sti_class = false
|
||||
|
|
|
|||
|
|
@ -4,13 +4,17 @@ module PersonalAccessTokens
|
|||
class RevokeService < BaseService
|
||||
attr_reader :token, :current_user, :group
|
||||
|
||||
VALID_SOURCES = %w[secret_detection].freeze
|
||||
VALID_SOURCES = %i[self secret_detection].freeze
|
||||
|
||||
def initialize(current_user = nil, token: nil, group: nil, source: nil)
|
||||
@current_user = current_user
|
||||
@token = token
|
||||
@group = group
|
||||
@source = source
|
||||
|
||||
@source = :self if @current_user && !@source
|
||||
|
||||
raise ArgumentError unless VALID_SOURCES.include?(@source)
|
||||
end
|
||||
|
||||
def execute
|
||||
|
|
@ -36,22 +40,21 @@ module PersonalAccessTokens
|
|||
end
|
||||
|
||||
def revocation_permitted?
|
||||
if current_user
|
||||
case @source
|
||||
when :self
|
||||
Ability.allowed?(current_user, :revoke_token, token)
|
||||
when :secret_detection
|
||||
true
|
||||
else
|
||||
source && VALID_SOURCES.include?(source)
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def source
|
||||
current_user&.username || @source
|
||||
end
|
||||
|
||||
def log_event
|
||||
Gitlab::AppLogger.info(
|
||||
class: self.class.name,
|
||||
message: "PAT Revoked",
|
||||
revoked_by: source,
|
||||
revoked_by: current_user&.username || @source,
|
||||
revoked_for: token.user.username,
|
||||
token_id: token.id)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
= _('Hi %{username}!') % { username: sanitize_name(@user.name) }
|
||||
%p
|
||||
= html_escape(_('A personal access token, named %{code_start}%{token_name}%{code_end}, has been revoked.')) % { code_start: '<code>'.html_safe, token_name: @token_name, code_end: '</code>'.html_safe }
|
||||
- if @source == 'secret_detection'
|
||||
- if @source == :secret_detection
|
||||
= _('We found your token in a public project and have automatically revoked it to protect your account.')
|
||||
%p
|
||||
- pat_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: @target_url }
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<%= _('Hi %{username}!') % { username: sanitize_name(@user.name) } %>
|
||||
|
||||
<%= _('A personal access token, named %{token_name}, has been revoked.') % { token_name: @token_name } %>
|
||||
<% if @source == 'secret_detection' %>
|
||||
<% if @source == :secret_detection %>
|
||||
|
||||
<%= _('We found your token in a public project and have automatically revoked it to protect your account.') %>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -1,6 +1 @@
|
|||
- if milestone.expired? && !milestone.closed?
|
||||
= gl_badge_tag _('Expired'), { variant: :warning }, { class: "gl-mb-2" }
|
||||
- if milestone.upcoming?
|
||||
= gl_badge_tag _('Upcoming'), { variant: :info }, { class: "gl-mb-2" }
|
||||
- if milestone.closed?
|
||||
= gl_badge_tag _('Closed'), { variant: :danger }, { class: "gl-mb-2" }
|
||||
= gl_badge_tag milestone_status_string(milestone), { variant: milestone_badge_variant(milestone) }, { class: 'gl-mb-2' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
.detail-page-header.milestone-page-header
|
||||
= render Pajamas::BadgeComponent.new(variant: status_box_variant(milestone), class: 'gl-mr-3') do
|
||||
= milestone_status_string(milestone)
|
||||
= gl_badge_tag milestone_status_string(milestone), { variant: milestone_badge_variant(milestone) }, { class: 'gl-mr-3' }
|
||||
|
||||
.header-text-content
|
||||
%span.identifier
|
||||
%strong
|
||||
|
|
|
|||
|
|
@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/367534
|
|||
milestone: '15.2'
|
||||
type: ops
|
||||
group: group::application performance
|
||||
default_enabled: false
|
||||
default_enabled: true
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
name: gitlab_memory_watchdog
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/91910
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/367534
|
||||
milestone: '15.2'
|
||||
type: ops
|
||||
group: group::application performance
|
||||
default_enabled: false
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,17 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddExcludedUrlsAndRequestHeadersToDastSiteProfiles < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
# rubocop:disable Migration/AddLimitToTextColumns
|
||||
# limit is added in 20210311022012_add_text_limits_to_dast_site_profiles
|
||||
def change
|
||||
add_column :dast_site_profiles, :excluded_urls, :text, array: true, default: [], null: false
|
||||
add_column :dast_site_profiles, :auth_enabled, :boolean, default: false, null: false
|
||||
add_column :dast_site_profiles, :auth_url, :text
|
||||
add_column :dast_site_profiles, :auth_username_field, :text
|
||||
add_column :dast_site_profiles, :auth_password_field, :text
|
||||
add_column :dast_site_profiles, :auth_username, :text
|
||||
end
|
||||
# rubocop:enable Migration/AddLimitToTextColumns
|
||||
end
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddDeployedDeploymentIdIndexToProjectPagesMetadata < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
INDEX_NAME = 'index_on_pages_metadata_not_migrated'
|
||||
|
||||
def up
|
||||
add_concurrent_index :project_pages_metadata, :project_id, where: "deployed = TRUE AND pages_deployment_id is NULL", name: INDEX_NAME
|
||||
end
|
||||
|
||||
def down
|
||||
remove_concurrent_index_by_name :project_pages_metadata, INDEX_NAME
|
||||
end
|
||||
end
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class RemoveIndexForSecurityOrchestrationPolicy < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
INDEX_NAME = 'index_sop_configs_on_security_policy_management_project_id'
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
remove_concurrent_index_by_name(:security_orchestration_policy_configurations, INDEX_NAME)
|
||||
end
|
||||
|
||||
def down
|
||||
add_concurrent_index(:security_orchestration_policy_configurations, :security_policy_management_project_id, name: INDEX_NAME)
|
||||
end
|
||||
end
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddIndexToSecurityOrchestrationPolicy < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
INDEX = 'index_sop_configurations_project_id_policy_project_id'
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_index :security_orchestration_policy_configurations, [:security_policy_management_project_id, :project_id], name: INDEX
|
||||
end
|
||||
|
||||
def down
|
||||
remove_concurrent_index_by_name :security_orchestration_policy_configurations, INDEX
|
||||
end
|
||||
end
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class RenameVulnFingerprintsIndexes < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
FINGERPRINT_IDX = :idx_vuln_fingerprints_on_occurrences_id_and_fingerprint
|
||||
FINGERPRINT_IDX_RENAMED = :idx_vuln_fingerprints_on_occurrences_id_and_fingerprint_sha256
|
||||
UNIQ_IDX = :idx_vuln_fingerprints_uniqueness
|
||||
UNIQ_IDX_RENAMED = :idx_vuln_fingerprints_uniqueness_fingerprint_sha256
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
# These `unless` checks are necessary for re-running the migrations multiple times
|
||||
unless index_exists_by_name?(:vulnerability_finding_fingerprints, FINGERPRINT_IDX_RENAMED)
|
||||
rename_index :vulnerability_finding_fingerprints, FINGERPRINT_IDX, FINGERPRINT_IDX_RENAMED
|
||||
end
|
||||
|
||||
unless index_exists_by_name?(:vulnerability_finding_fingerprints, UNIQ_IDX_RENAMED)
|
||||
rename_index :vulnerability_finding_fingerprints, UNIQ_IDX, UNIQ_IDX_RENAMED
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
unless index_exists_by_name?(:vulnerability_finding_fingerprints, FINGERPRINT_IDX)
|
||||
rename_index :vulnerability_finding_fingerprints, FINGERPRINT_IDX_RENAMED, FINGERPRINT_IDX
|
||||
end
|
||||
|
||||
unless index_exists_by_name?(:vulnerability_finding_fingerprints, UNIQ_IDX)
|
||||
rename_index :vulnerability_finding_fingerprints, UNIQ_IDX_RENAMED, UNIQ_IDX
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddLastEditedAtAndLastEditedByIdToNotes < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
def up
|
||||
with_lock_retries do
|
||||
add_column :notes, :last_edited_at, :datetime_with_timezone
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
with_lock_retries do
|
||||
remove_column :notes, :last_edited_at
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddIndexToEnvironmentsTier < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
INDEX_NAME = 'index_environments_on_project_id_and_tier'
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
def up
|
||||
add_concurrent_index :environments, [:project_id, :tier], where: 'tier IS NOT NULL', name: INDEX_NAME
|
||||
end
|
||||
|
||||
def down
|
||||
remove_concurrent_index :environments, :state, name: INDEX_NAME
|
||||
end
|
||||
end
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddIndexForSucceededDeployments < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
INDEX_NAME = 'index_deployments_on_environment_id_status_and_finished_at'
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_index(:deployments, %i[environment_id status finished_at], name: INDEX_NAME)
|
||||
end
|
||||
|
||||
def down
|
||||
remove_concurrent_index_by_name(:deployments, INDEX_NAME)
|
||||
end
|
||||
end
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullConstraintToClusterTokenName < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
# This will add the `NOT NULL` constraint WITHOUT validating it
|
||||
add_not_null_constraint :cluster_agent_tokens, :name, validate: false
|
||||
end
|
||||
|
||||
def down
|
||||
remove_not_null_constraint :cluster_agent_tokens, :name
|
||||
end
|
||||
end
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddConcurrentFieldsToBulkImportsTrackers < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
# rubocop:disable Migration/AddLimitToTextColumns
|
||||
# rubocop:disable Rails/NotNullColumn
|
||||
def up
|
||||
add_column :bulk_import_trackers, :jid, :text
|
||||
add_column :bulk_import_trackers, :stage, :smallint, default: 0, null: false
|
||||
add_column :bulk_import_trackers, :status, :smallint, default: 0, null: false
|
||||
end
|
||||
# rubocop:enable Migration/AddLimitToTextColumns
|
||||
# rubocop:enable Rails/NotNullColumn
|
||||
|
||||
def down
|
||||
remove_column :bulk_import_trackers, :jid, :text
|
||||
remove_column :bulk_import_trackers, :stage, :smallint
|
||||
remove_column :bulk_import_trackers, :status, :smallint
|
||||
end
|
||||
end
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddTextLimitsToBulkImportsTrackersJidAndPipelineName < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_text_limit :bulk_import_trackers, :jid, 255
|
||||
end
|
||||
|
||||
def down
|
||||
remove_text_limit :bulk_import_trackers, :jid
|
||||
end
|
||||
end
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class UpdateTerraformStatesLockedByUserIdForeignKey < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
OLD_FOREIGN_KEY = 'fk_rails_558901b030'
|
||||
NEW_FOREIGN_KEY = 'fk_558901b030'
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_foreign_key :terraform_states, :users,
|
||||
column: :locked_by_user_id, on_delete: :nullify, name: NEW_FOREIGN_KEY
|
||||
|
||||
with_lock_retries do
|
||||
remove_foreign_key :terraform_states, :users, name: OLD_FOREIGN_KEY
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
add_concurrent_foreign_key :terraform_states, :users,
|
||||
column: :locked_by_user_id, on_delete: nil, name: OLD_FOREIGN_KEY
|
||||
|
||||
with_lock_retries do
|
||||
remove_foreign_key :terraform_states, :users, name: NEW_FOREIGN_KEY
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddTextLimitToGroupCiVariablesEnvironmentScope < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_text_limit :ci_group_variables, :environment_scope, 255
|
||||
end
|
||||
|
||||
def down
|
||||
remove_text_limit :ci_group_variables, :environment_scope
|
||||
end
|
||||
end
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CreateDastSiteProfileVariables < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
table_comment = { owner: 'group::dynamic analysis', description: 'Secret variables used in DAST on-demand scans' }
|
||||
|
||||
encrypted_value_constraint_name = check_constraint_name(:dast_site_profile_secret_variables, 'encrypted_value', 'max_length')
|
||||
encrypted_value_iv_constraint_name = check_constraint_name(:dast_site_profile_secret_variables, 'encrypted_value_iv', 'max_length')
|
||||
|
||||
create_table_with_constraints :dast_site_profile_secret_variables, comment: Gitlab::Json.dump(table_comment) do |t|
|
||||
t.references :dast_site_profile, null: false, foreign_key: { on_delete: :cascade }, index: false
|
||||
|
||||
t.timestamps_with_timezone
|
||||
|
||||
t.integer :variable_type, null: false, default: 1, limit: 2
|
||||
|
||||
t.text :key, null: false
|
||||
t.binary :encrypted_value, null: false
|
||||
t.binary :encrypted_value_iv, null: false, unique: true
|
||||
|
||||
t.index [:dast_site_profile_id, :key], unique: true, name: :index_site_profile_secret_variables_on_site_profile_id_and_key
|
||||
|
||||
t.text_limit :key, 255
|
||||
|
||||
# This does not currently have first-class support via create_table_with_constraints
|
||||
t.check_constraint encrypted_value_constraint_name, 'length(encrypted_value) <= 13352'
|
||||
t.check_constraint encrypted_value_iv_constraint_name, 'length(encrypted_value_iv) <= 17'
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :dast_site_profile_secret_variables
|
||||
end
|
||||
end
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddTerraformModuleMaxFileSizeToPlanLimits < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def change
|
||||
add_column :plan_limits, :terraform_module_max_file_size, :bigint, default: 1.gigabyte, null: false
|
||||
end
|
||||
end
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CreateCiUnitTests < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
unless table_exists?(:ci_unit_tests)
|
||||
create_table :ci_unit_tests do |t|
|
||||
t.bigint :project_id, null: false
|
||||
t.text :key_hash, null: false
|
||||
t.text :name, null: false
|
||||
t.text :suite_name, null: false
|
||||
|
||||
t.index [:project_id, :key_hash], unique: true
|
||||
# NOTE: FK for projects will be added on a separate migration as per guidelines
|
||||
end
|
||||
end
|
||||
|
||||
add_text_limit :ci_unit_tests, :key_hash, 64
|
||||
add_text_limit :ci_unit_tests, :name, 255
|
||||
add_text_limit :ci_unit_tests, :suite_name, 255
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :ci_unit_tests
|
||||
end
|
||||
end
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddProjectsFkToCiUnitTests < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_foreign_key :ci_unit_tests, :projects, column: :project_id, on_delete: :cascade
|
||||
end
|
||||
|
||||
def down
|
||||
with_lock_retries do
|
||||
remove_foreign_key :ci_unit_tests, column: :project_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CreateCiUnitTestFailures < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def up
|
||||
create_table :ci_unit_test_failures do |t|
|
||||
t.datetime_with_timezone :failed_at, null: false
|
||||
t.bigint :unit_test_id, null: false
|
||||
t.bigint :build_id, null: false
|
||||
|
||||
t.index [:unit_test_id, :failed_at, :build_id], name: 'index_unit_test_failures_unique_columns', unique: true, order: { failed_at: :desc }
|
||||
t.index :build_id
|
||||
# NOTE: Adding the index for failed_at now for later use when we do scheduled clean up
|
||||
t.index :failed_at, order: { failed_at: :desc }, name: 'index_unit_test_failures_failed_at'
|
||||
t.foreign_key :ci_unit_tests, column: :unit_test_id, on_delete: :cascade
|
||||
# NOTE: FK for ci_builds will be added on a separate migration as per guidelines
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :ci_unit_test_failures
|
||||
end
|
||||
end
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddCiBuildsFkToCiUnitTestFailures < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_foreign_key :ci_unit_test_failures, :ci_builds, column: :build_id, on_delete: :cascade
|
||||
end
|
||||
|
||||
def down
|
||||
with_lock_retries do
|
||||
remove_foreign_key :ci_unit_test_failures, column: :build_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class PartitionWebHookLogs < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
include Gitlab::Database::PartitioningMigrationHelpers
|
||||
|
||||
# Set this constant to true if this migration requires downtime.
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
partition_table_by_date :web_hook_logs, :created_at
|
||||
end
|
||||
|
||||
def down
|
||||
drop_partitioned_table_for :web_hook_logs
|
||||
end
|
||||
end
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddInfoColumnIntoSecurityScansTable < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def change
|
||||
add_column :security_scans, :info, :jsonb, null: false, default: {}
|
||||
end
|
||||
end
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ChangeNamespaceSettingsDelayedProjectRemovalNull < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def up
|
||||
change_column :namespace_settings, :delayed_project_removal, :boolean, null: true, default: nil
|
||||
end
|
||||
|
||||
def down
|
||||
change_column_default :namespace_settings, :delayed_project_removal, false
|
||||
change_column_null :namespace_settings, :delayed_project_removal, false, false
|
||||
end
|
||||
end
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddLockDelayedProjectRemovalToNamespaceSettings < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def change
|
||||
add_column :namespace_settings, :lock_delayed_project_removal, :boolean, default: false, null: false
|
||||
end
|
||||
end
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddDelayedProjectRemovalToApplicationSettings < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def change
|
||||
add_column :application_settings, :delayed_project_removal, :boolean, default: false, null: false
|
||||
end
|
||||
end
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddLockDelayedProjectRemovalToApplicationSettings < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def change
|
||||
add_column :application_settings, :lock_delayed_project_removal, :boolean, default: false, null: false
|
||||
end
|
||||
end
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ChangeBatchedBackgroundMigrationsBatchClassNameDefault < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def change
|
||||
change_column_default :batched_background_migrations, :batch_class_name,
|
||||
from: 'Gitlab::Database::BackgroundMigration::PrimaryKeyBatchingStrategy', to: 'PrimaryKeyBatchingStrategy'
|
||||
end
|
||||
end
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddAdminModeToApplicationSetting < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def change
|
||||
add_column :application_settings, :admin_mode, :boolean, default: false, null: false
|
||||
end
|
||||
end
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddLastUsedAtToClusterAgentToken < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def change
|
||||
add_column :cluster_agent_tokens, :last_used_at, :datetime_with_timezone
|
||||
end
|
||||
end
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
# 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 AddIdxVulnerabilityOccurrencesDedup < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
TABLE = :vulnerability_occurrences
|
||||
INDEX_NAME = 'index_vulnerability_occurrences_deduplication'
|
||||
COLUMNS = %i[project_id report_type project_fingerprint]
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_index TABLE, COLUMNS, name: INDEX_NAME
|
||||
end
|
||||
|
||||
def down
|
||||
remove_concurrent_index TABLE, COLUMNS, name: INDEX_NAME
|
||||
end
|
||||
end
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddSettingsToGroupMergeRequestApprovalSettings < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def change
|
||||
change_table(:group_merge_request_approval_settings, bulk: true) do |t|
|
||||
t.column :allow_committer_approval, :boolean, null: false, default: false
|
||||
t.column :allow_overrides_to_approver_list_per_merge_request, :boolean, null: false, default: false
|
||||
t.column :retain_approvals_on_push, :boolean, null: false, default: false
|
||||
t.column :require_password_to_approve, :boolean, null: false, default: false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddTextLimitsToDastSiteProfiles < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
# Set this constant to true if this migration requires downtime.
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_text_limit :dast_site_profiles, :auth_url, 1024
|
||||
add_text_limit :dast_site_profiles, :auth_username_field, 255
|
||||
add_text_limit :dast_site_profiles, :auth_password_field, 255
|
||||
add_text_limit :dast_site_profiles, :auth_username, 255
|
||||
end
|
||||
|
||||
def down
|
||||
remove_text_limit :dast_site_profiles, :auth_username
|
||||
remove_text_limit :dast_site_profiles, :auth_password_field
|
||||
remove_text_limit :dast_site_profiles, :auth_username_field
|
||||
remove_text_limit :dast_site_profiles, :auth_url
|
||||
end
|
||||
end
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddMetricsToBatchedBackgroundMigrationJobs < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def change
|
||||
add_column :batched_background_migration_jobs, :metrics, :jsonb, null: false, default: {}
|
||||
end
|
||||
end
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class InitializeConversionOfEventsIdToBigint < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
def up
|
||||
# Initialize the conversion of events.id to bigint
|
||||
# Primary Key of the Events table
|
||||
initialize_conversion_of_integer_to_bigint :events, :id
|
||||
end
|
||||
|
||||
def down
|
||||
trigger_name = rename_trigger_name(:events, :id, :id_convert_to_bigint)
|
||||
|
||||
remove_rename_triggers :events, trigger_name
|
||||
|
||||
remove_column :events, :id_convert_to_bigint
|
||||
end
|
||||
end
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class InitializeConversionOfPushEventPayloadsEventIdToBigint < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
def up
|
||||
# Foreign key that references events.id
|
||||
# Also Primary key of the push_event_payloads table
|
||||
initialize_conversion_of_integer_to_bigint :push_event_payloads, :event_id, primary_key: :event_id
|
||||
end
|
||||
|
||||
def down
|
||||
trigger_name = rename_trigger_name(:push_event_payloads, :event_id, :event_id_convert_to_bigint)
|
||||
|
||||
remove_rename_triggers :push_event_payloads, trigger_name
|
||||
|
||||
remove_column :push_event_payloads, :event_id_convert_to_bigint
|
||||
end
|
||||
end
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddOwnerAndIdIndexOnActiveCiPipelineSchedules < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
INDEX_NAME = 'index_ci_pipeline_schedules_on_owner_id_and_id_and_active'
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_index :ci_pipeline_schedules, [:owner_id, :id], where: "active = TRUE", name: INDEX_NAME
|
||||
end
|
||||
|
||||
def down
|
||||
remove_concurrent_index_by_name :ci_pipeline_schedules, INDEX_NAME
|
||||
end
|
||||
end
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddEnforcedGitCheckToSamlProvider < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def up
|
||||
add_column :saml_providers, :git_check_enforced, :boolean, default: false, null: false
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :saml_providers, :git_check_enforced
|
||||
end
|
||||
end
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
class AddResourceAccessTokenCreationAllowedToNamespaceSettings < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
with_lock_retries do
|
||||
add_column :namespace_settings, :resource_access_token_creation_allowed, :boolean, default: true, null: false
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
with_lock_retries do
|
||||
remove_column :namespace_settings, :resource_access_token_creation_allowed
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddVerificationStateAndStartedAtToSnippetRepositories < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def change
|
||||
change_table(:snippet_repositories) do |t|
|
||||
t.integer :verification_state, default: 0, limit: 2, null: false
|
||||
t.column :verification_started_at, :datetime_with_timezone
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddVerificationIndexesToSnippetRepositories < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
VERIFICATION_STATE_INDEX_NAME = "index_snippet_repositories_verification_state"
|
||||
PENDING_VERIFICATION_INDEX_NAME = "index_snippet_repositories_pending_verification"
|
||||
FAILED_VERIFICATION_INDEX_NAME = "index_snippet_repositories_failed_verification"
|
||||
NEEDS_VERIFICATION_INDEX_NAME = "index_snippet_repositories_needs_verification"
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_index :snippet_repositories, :verification_state, name: VERIFICATION_STATE_INDEX_NAME
|
||||
add_concurrent_index :snippet_repositories, :verified_at, where: "(verification_state = 0)", order: { verified_at: 'ASC NULLS FIRST' }, name: PENDING_VERIFICATION_INDEX_NAME
|
||||
add_concurrent_index :snippet_repositories, :verification_retry_at, where: "(verification_state = 3)", order: { verification_retry_at: 'ASC NULLS FIRST' }, name: FAILED_VERIFICATION_INDEX_NAME
|
||||
add_concurrent_index :snippet_repositories, :verification_state, where: "(verification_state = 0 OR verification_state = 3)", name: NEEDS_VERIFICATION_INDEX_NAME
|
||||
end
|
||||
|
||||
def down
|
||||
remove_concurrent_index_by_name :snippet_repositories, VERIFICATION_STATE_INDEX_NAME
|
||||
remove_concurrent_index_by_name :snippet_repositories, PENDING_VERIFICATION_INDEX_NAME
|
||||
remove_concurrent_index_by_name :snippet_repositories, FAILED_VERIFICATION_INDEX_NAME
|
||||
remove_concurrent_index_by_name :snippet_repositories, NEEDS_VERIFICATION_INDEX_NAME
|
||||
end
|
||||
end
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddTrialExtensionTypeToGitlabSubscriptionHistories < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def change
|
||||
add_column :gitlab_subscription_histories, :trial_extension_type, :smallint
|
||||
end
|
||||
end
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddTrialExtensionTypeToGitlabSubscriptions < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
with_lock_retries do
|
||||
add_column :gitlab_subscriptions, :trial_extension_type, :smallint
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
with_lock_retries do
|
||||
remove_column :gitlab_subscriptions, :trial_extension_type
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddIndexCiStagesOnPipelineIdAndId < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
INDEX_NAME = 'index_ci_stages_on_pipeline_id_and_id'
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_index :ci_stages, %i[pipeline_id id], where: 'status IN (0, 1, 2, 8, 9, 10)', name: INDEX_NAME
|
||||
end
|
||||
|
||||
def down
|
||||
remove_concurrent_index_by_name :ci_stages, INDEX_NAME
|
||||
end
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CreatePackagesHelmFileMetadata < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
def up
|
||||
create_table_with_constraints :packages_helm_file_metadata, id: false do |t|
|
||||
t.timestamps_with_timezone
|
||||
t.references :package_file, primary_key: true, index: false, default: nil, null: false, foreign_key: { to_table: :packages_package_files, on_delete: :cascade }, type: :bigint
|
||||
t.text :channel, null: false
|
||||
t.jsonb :metadata
|
||||
|
||||
t.text_limit :channel, 63
|
||||
|
||||
t.index :channel
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
with_lock_retries do
|
||||
drop_table :packages_helm_file_metadata
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CreateDastProfilesPipelines < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def up
|
||||
table_comment = { owner: 'group::dynamic analysis', description: 'Join table between DAST Profiles and CI Pipelines' }
|
||||
|
||||
create_table :dast_profiles_pipelines, primary_key: [:dast_profile_id, :ci_pipeline_id], comment: Gitlab::Json.dump(table_comment) do |t|
|
||||
t.bigint :dast_profile_id, null: false
|
||||
t.bigint :ci_pipeline_id, null: false
|
||||
|
||||
t.index :ci_pipeline_id, unique: true, name: :index_dast_profiles_pipelines_on_ci_pipeline_id
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :dast_profiles_pipelines
|
||||
end
|
||||
end
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CreateElasticIndexSettings < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
def up
|
||||
create_table_with_constraints :elastic_index_settings do |t|
|
||||
t.timestamps_with_timezone null: false
|
||||
t.integer :number_of_replicas, null: false, default: 1, limit: 2
|
||||
t.integer :number_of_shards, null: false, default: 5, limit: 2
|
||||
t.text :alias_name, null: false
|
||||
|
||||
t.text_limit :alias_name, 255
|
||||
t.index :alias_name, unique: true
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :elastic_index_settings
|
||||
end
|
||||
end
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CreateInProductMarketingEmails < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
UNIQUE_INDEX_NAME = 'index_in_product_marketing_emails_on_user_track_series'
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
with_lock_retries do
|
||||
create_table :in_product_marketing_emails do |t|
|
||||
t.bigint :user_id, null: false
|
||||
t.datetime_with_timezone :cta_clicked_at
|
||||
t.integer :track, null: false, limit: 2
|
||||
t.integer :series, null: false, limit: 2
|
||||
|
||||
t.timestamps_with_timezone
|
||||
end
|
||||
end
|
||||
|
||||
add_index :in_product_marketing_emails, :user_id
|
||||
add_index :in_product_marketing_emails, [:user_id, :track, :series], unique: true, name: UNIQUE_INDEX_NAME
|
||||
end
|
||||
|
||||
def down
|
||||
with_lock_retries do
|
||||
drop_table :in_product_marketing_emails
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddUserForeignKeyToInProductMarketingEmails < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_foreign_key :in_product_marketing_emails, :users, column: :user_id, on_delete: :cascade
|
||||
end
|
||||
|
||||
def down
|
||||
with_lock_retries do
|
||||
remove_foreign_key :in_product_marketing_emails, column: :user_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddThrottlePackageRegistryColumns < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def change
|
||||
add_column :application_settings, :throttle_unauthenticated_packages_api_requests_per_period, :integer, default: 800, null: false
|
||||
add_column :application_settings, :throttle_unauthenticated_packages_api_period_in_seconds, :integer, default: 15, null: false
|
||||
add_column :application_settings, :throttle_authenticated_packages_api_requests_per_period, :integer, default: 1000, null: false
|
||||
add_column :application_settings, :throttle_authenticated_packages_api_period_in_seconds, :integer, default: 15, null: false
|
||||
add_column :application_settings, :throttle_unauthenticated_packages_api_enabled, :boolean, default: false, null: false
|
||||
add_column :application_settings, :throttle_authenticated_packages_api_enabled, :boolean, default: false, null: false
|
||||
end
|
||||
end
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddExpiryNotificationDeliveredToKeys < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def change
|
||||
add_column :keys, :expiry_notification_delivered_at, :datetime_with_timezone
|
||||
end
|
||||
end
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddValidRunnerRegistrars < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :application_settings, :valid_runner_registrars, :string, array: true, default: %w(project group)
|
||||
end
|
||||
end
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class DeleteSecurityFindingsWithoutUuid < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
class SecurityFinding < ActiveRecord::Base
|
||||
include EachBatch
|
||||
|
||||
self.table_name = 'security_findings'
|
||||
|
||||
scope :without_uuid, -> { where(uuid: nil) }
|
||||
end
|
||||
|
||||
def up
|
||||
SecurityFinding.without_uuid.each_batch(of: 10_000) do |relation|
|
||||
relation.delete_all
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
# no-op
|
||||
end
|
||||
end
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddHelmMaxFileSizeToPlanLimits < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def change
|
||||
add_column :plan_limits, :helm_max_file_size, :bigint, default: 5.megabyte, null: false
|
||||
end
|
||||
end
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddDastProfileIdFkToDastProfilesPipelines < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_foreign_key :dast_profiles_pipelines, :dast_profiles, column: :dast_profile_id, on_delete: :cascade
|
||||
end
|
||||
|
||||
def down
|
||||
with_lock_retries do
|
||||
remove_foreign_key :dast_profiles_pipelines, column: :dast_profile_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddCiPipelineIdFkToDastProfilesPipelines < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_foreign_key :dast_profiles_pipelines, :ci_pipelines, column: :ci_pipeline_id, on_delete: :cascade
|
||||
end
|
||||
|
||||
def down
|
||||
with_lock_retries do
|
||||
remove_foreign_key :dast_profiles_pipelines, column: :ci_pipeline_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddIndexToKeysOnExpiresAtAndExpiryNotificationUndelivered < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
INDEX_NAME = 'index_keys_on_expires_at_and_expiry_notification_undelivered'
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_index :keys,
|
||||
"date(timezone('UTC', expires_at)), expiry_notification_delivered_at",
|
||||
where: 'expiry_notification_delivered_at IS NULL', name: INDEX_NAME
|
||||
end
|
||||
|
||||
def down
|
||||
remove_concurrent_index_by_name(:keys, INDEX_NAME)
|
||||
end
|
||||
end
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNamespaceTraversalIdsIndex < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
INDEX_NAME = 'index_namespaces_on_traversal_ids'
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_index :namespaces, :traversal_ids, using: :gin, name: INDEX_NAME
|
||||
end
|
||||
|
||||
def down
|
||||
remove_concurrent_index_by_name :namespaces, INDEX_NAME
|
||||
end
|
||||
end
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CreateStatusCheckResponsesTable < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
def up
|
||||
create_table :status_check_responses do |t|
|
||||
t.bigint :merge_request_id, null: false
|
||||
t.bigint :external_approval_rule_id, null: false
|
||||
end
|
||||
|
||||
add_index :status_check_responses, :merge_request_id
|
||||
add_index :status_check_responses, :external_approval_rule_id
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :status_check_responses
|
||||
end
|
||||
end
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddMergeRequestForeignKeyToStatusCheckResponses < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_foreign_key :status_check_responses, :merge_requests, column: :merge_request_id, on_delete: :cascade
|
||||
end
|
||||
|
||||
def down
|
||||
with_lock_retries do
|
||||
remove_foreign_key :status_check_responses, column: :merge_request_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddExternalApprovalRuleForeignKeyToStatusCheckResponses < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_foreign_key :status_check_responses, :external_approval_rules, column: :external_approval_rule_id, on_delete: :cascade
|
||||
end
|
||||
|
||||
def down
|
||||
with_lock_retries do
|
||||
remove_foreign_key :status_check_responses, column: :external_approval_rule_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class PopulateDismissalInformationForVulnerabilities < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
BATCH_SIZE = 100
|
||||
UPDATE_QUERY = <<~SQL
|
||||
UPDATE
|
||||
vulnerabilities
|
||||
SET
|
||||
dismissed_at = COALESCE(dismissed_at, updated_at),
|
||||
dismissed_by_id = COALESCE(dismissed_by_id, updated_by_id, last_edited_by_id, author_id)
|
||||
WHERE
|
||||
vulnerabilities.id IN (%{ids})
|
||||
SQL
|
||||
|
||||
class Vulnerability < ActiveRecord::Base
|
||||
include EachBatch
|
||||
|
||||
self.table_name = 'vulnerabilities'
|
||||
|
||||
enum state: { detected: 1, confirmed: 4, resolved: 3, dismissed: 2 }
|
||||
|
||||
scope :broken, -> { dismissed.where('dismissed_at IS NULL OR dismissed_by_id IS NULL') }
|
||||
end
|
||||
|
||||
def up
|
||||
Vulnerability.broken.each_batch(of: BATCH_SIZE) do |batch|
|
||||
query = format(UPDATE_QUERY, ids: batch.select(:id).to_sql)
|
||||
|
||||
connection.execute(query)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
# no-op
|
||||
end
|
||||
end
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddProjectStatusDateIndexToMergeRequests < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
INDEX_NAME = "idx_mrs_on_target_id_and_created_at_and_state_id"
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_index :merge_requests, %i[target_project_id state_id created_at id], name: INDEX_NAME
|
||||
end
|
||||
|
||||
def down
|
||||
remove_concurrent_index_by_name :merge_requests, INDEX_NAME
|
||||
end
|
||||
end
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
# 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 AddIndexMirrorDataOnRetryNextExecutionWhereStatus < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
INDEX_NAME = 'index_mirror_data_non_scheduled_or_started'
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_index :project_mirror_data,
|
||||
[:next_execution_timestamp, :retry_count],
|
||||
where: "(status)::text <> ALL ('{scheduled,started}'::text[])",
|
||||
name: INDEX_NAME
|
||||
end
|
||||
|
||||
def down
|
||||
remove_concurrent_index :project_mirror_data,
|
||||
[:next_execution_timestamp, :retry_count],
|
||||
where: "(status)::text <> ALL ('{scheduled,started}'::text[])",
|
||||
name: INDEX_NAME
|
||||
end
|
||||
end
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class MigrateElasticIndexSettings < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
ALIAS_NAME = [Rails.application.class.module_parent_name.downcase, Rails.env].join('-')
|
||||
|
||||
class ElasticIndexSetting < ActiveRecord::Base
|
||||
end
|
||||
|
||||
class ApplicationSetting < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def up
|
||||
setting = ApplicationSetting.first
|
||||
number_of_replicas = setting&.elasticsearch_replicas || 1
|
||||
number_of_shards = setting&.elasticsearch_shards || 5
|
||||
|
||||
return if ElasticIndexSetting.exists?(alias_name: ALIAS_NAME)
|
||||
|
||||
ElasticIndexSetting.create!(
|
||||
alias_name: ALIAS_NAME,
|
||||
number_of_replicas: number_of_replicas,
|
||||
number_of_shards: number_of_shards
|
||||
)
|
||||
end
|
||||
|
||||
def down
|
||||
ElasticIndexSetting.where(alias_name: ALIAS_NAME).delete_all
|
||||
end
|
||||
end
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNotValidForeignKeyToGroupHooks < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
def up
|
||||
with_lock_retries do
|
||||
add_foreign_key :web_hooks, :namespaces, column: :group_id, on_delete: :cascade, validate: false
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
with_lock_retries do
|
||||
remove_foreign_key_if_exists :web_hooks, column: :group_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ValidateForeignKeyOnServiceHooks < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
CONSTRAINT_NAME = 'fk_d47999a98a'
|
||||
|
||||
def up
|
||||
validate_foreign_key :web_hooks, :service_id, name: CONSTRAINT_NAME
|
||||
end
|
||||
|
||||
def down
|
||||
# no-op
|
||||
end
|
||||
end
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddVerificationStateToCiPipelineArtifact < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def change
|
||||
change_table(:ci_pipeline_artifacts, bulk: true) do |t|
|
||||
t.column :verification_started_at, :datetime_with_timezone
|
||||
t.column :verification_retry_at, :datetime_with_timezone
|
||||
t.column :verified_at, :datetime_with_timezone
|
||||
t.integer :verification_state, default: 0, limit: 2, null: false
|
||||
t.integer :verification_retry_count, limit: 2
|
||||
t.binary :verification_checksum, using: 'verification_checksum::bytea'
|
||||
|
||||
t.text :verification_failure # rubocop:disable Migration/AddLimitToTextColumns
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddVerificationFailureLimitToCiPipelineArtifact < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
CONSTRAINT_NAME = 'ci_pipeline_artifacts_verification_failure_text_limit'
|
||||
|
||||
def up
|
||||
add_text_limit :ci_pipeline_artifacts, :verification_failure, 255, constraint_name: CONSTRAINT_NAME
|
||||
end
|
||||
|
||||
def down
|
||||
remove_check_constraint(:ci_pipeline_artifacts, CONSTRAINT_NAME)
|
||||
end
|
||||
end
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddVerificationIndexesToCiPipelineArtifacts < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
VERIFICATION_STATE_INDEX_NAME = "index_ci_pipeline_artifacts_verification_state"
|
||||
PENDING_VERIFICATION_INDEX_NAME = "index_ci_pipeline_artifacts_pending_verification"
|
||||
FAILED_VERIFICATION_INDEX_NAME = "index_ci_pipeline_artifacts_failed_verification"
|
||||
NEEDS_VERIFICATION_INDEX_NAME = "index_ci_pipeline_artifacts_needs_verification"
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_index :ci_pipeline_artifacts, :verification_state, name: VERIFICATION_STATE_INDEX_NAME
|
||||
add_concurrent_index :ci_pipeline_artifacts, :verified_at, where: "(verification_state = 0)", order: { verified_at: 'ASC NULLS FIRST' }, name: PENDING_VERIFICATION_INDEX_NAME
|
||||
add_concurrent_index :ci_pipeline_artifacts, :verification_retry_at, where: "(verification_state = 3)", order: { verification_retry_at: 'ASC NULLS FIRST' }, name: FAILED_VERIFICATION_INDEX_NAME
|
||||
add_concurrent_index :ci_pipeline_artifacts, :verification_state, where: "(verification_state = 0 OR verification_state = 3)", name: NEEDS_VERIFICATION_INDEX_NAME
|
||||
end
|
||||
|
||||
def down
|
||||
remove_concurrent_index_by_name :ci_pipeline_artifacts, VERIFICATION_STATE_INDEX_NAME
|
||||
remove_concurrent_index_by_name :ci_pipeline_artifacts, PENDING_VERIFICATION_INDEX_NAME
|
||||
remove_concurrent_index_by_name :ci_pipeline_artifacts, FAILED_VERIFICATION_INDEX_NAME
|
||||
remove_concurrent_index_by_name :ci_pipeline_artifacts, NEEDS_VERIFICATION_INDEX_NAME
|
||||
end
|
||||
end
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddIndexForProjectDeploymentsWithEnvironmentIdAndUpdatedAt < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
INDEX_NAME = 'index_deployments_on_project_and_environment_and_updated_at'
|
||||
|
||||
def up
|
||||
add_concurrent_index :deployments, [:project_id, :environment_id, :updated_at], name: INDEX_NAME
|
||||
end
|
||||
|
||||
def down
|
||||
remove_concurrent_index_by_name :deployments, INDEX_NAME
|
||||
end
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CreateVulnerabilityFindingEvidences < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
create_table_with_constraints :vulnerability_finding_evidences do |t|
|
||||
t.timestamps_with_timezone null: false
|
||||
|
||||
t.references :vulnerability_occurrence, index: { name: 'finding_evidences_on_vulnerability_occurrence_id' }, null: false, foreign_key: { on_delete: :cascade }
|
||||
t.text :summary
|
||||
|
||||
t.text_limit :summary, 8_000_000
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
with_lock_retries do
|
||||
drop_table :vulnerability_finding_evidences
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddTargetProjectAndSourceBranchIndexToMergeRequest < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
INDEX_NAME = 'index_merge_requests_on_target_project_id_and_source_branch'
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_index :merge_requests, [:target_project_id, :source_branch], name: INDEX_NAME
|
||||
end
|
||||
|
||||
def down
|
||||
remove_concurrent_index_by_name :epic_issues, INDEX_NAME
|
||||
end
|
||||
end
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddFindingSignatureTable < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
SIGNATURE_IDX = :idx_vuln_signatures_on_occurrences_id_and_signature_sha
|
||||
UNIQ_IDX = :idx_vuln_signatures_uniqueness_signature_sha
|
||||
|
||||
def up
|
||||
with_lock_retries do
|
||||
create_table :vulnerability_finding_signatures do |t|
|
||||
t.references :finding,
|
||||
index: true,
|
||||
null: false,
|
||||
foreign_key: { to_table: :vulnerability_occurrences, column: :finding_id, on_delete: :cascade }
|
||||
|
||||
t.timestamps_with_timezone null: false
|
||||
|
||||
t.integer :algorithm_type, null: false, limit: 2
|
||||
t.binary :signature_sha, null: false
|
||||
|
||||
t.index %i[finding_id signature_sha],
|
||||
name: SIGNATURE_IDX,
|
||||
unique: true # only one link should exist between occurrence and the signature
|
||||
|
||||
t.index %i[finding_id algorithm_type signature_sha],
|
||||
name: UNIQ_IDX,
|
||||
unique: true # these should be unique
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
with_lock_retries do
|
||||
drop_table :vulnerability_finding_signatures
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddCompositeIndexToAwardEmoji < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
INDEX_NAME = 'idx_award_emoji_on_user_emoji_name_awardable_type_awardable_id'
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_index :award_emoji, %i[user_id name awardable_type awardable_id], name: INDEX_NAME
|
||||
end
|
||||
|
||||
def down
|
||||
remove_concurrent_index_by_name :award_emoji, INDEX_NAME
|
||||
end
|
||||
end
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddCloudToLicenses < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def change
|
||||
add_column :licenses, :cloud, :boolean, default: false
|
||||
end
|
||||
end
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddConfigToCiRunners < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :ci_runners, :config, :jsonb, default: {}, null: false
|
||||
end
|
||||
end
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddDefaultTargetProject < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
def up
|
||||
with_lock_retries do
|
||||
add_column :project_settings, :mr_default_target_self, :boolean, default: false, null: false
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
with_lock_retries do
|
||||
remove_column :project_settings, :mr_default_target_self
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddIndexForLastDeployment < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
INDEX_NAME = 'index_deployments_on_environment_id_status_and_id'
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_index :deployments, [:environment_id, :status, :id], name: INDEX_NAME
|
||||
end
|
||||
|
||||
def down
|
||||
remove_concurrent_index_by_name :deployments, INDEX_NAME
|
||||
end
|
||||
end
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class RemoveDeprecatedIndexFromAwardEmoji < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
INDEX_NAME = 'index_award_emoji_on_user_id_and_name'
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
# Index deprecated in favor of idx_award_emoji_on_user_emoji_name_awardable_type_awardable_id
|
||||
remove_concurrent_index_by_name(:award_emoji, INDEX_NAME)
|
||||
end
|
||||
|
||||
def down
|
||||
add_concurrent_index(:award_emoji, [:user_id, :name], name: INDEX_NAME)
|
||||
end
|
||||
end
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddIndexToPagesDeployments < ActiveRecord::Migration[6.0]
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
INDEX_NAME = 'index_pages_deployments_on_file_store_and_id'
|
||||
|
||||
def up
|
||||
add_concurrent_index :pages_deployments, [:file_store, :id], name: INDEX_NAME
|
||||
end
|
||||
|
||||
def down
|
||||
remove_concurrent_index_by_name :pages_deployments, INDEX_NAME
|
||||
end
|
||||
end
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue