Commit 4ce8c43a authored by Subashis's avatar Subashis Committed by Mehmet Emin INAC

Drop `position` column from `security_findings` table

- Drop column
- Add specs

Changelog: removed
MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/78665
parent d316eaa0
# frozen_string_literal: true
class DropPositionFromSecurityFindings < Gitlab::Database::Migration[1.0]
enable_lock_retries!
def change
remove_column :security_findings, :position, :integer
end
end
69d8283501ba6a4946a60e3812fe2cf3031fc4a915d6e7c6fac3bf272423f2f2
\ No newline at end of file
...@@ -19394,7 +19394,6 @@ CREATE TABLE security_findings ( ...@@ -19394,7 +19394,6 @@ CREATE TABLE security_findings (
confidence smallint NOT NULL, confidence smallint NOT NULL,
project_fingerprint text, project_fingerprint text,
deduplicated boolean DEFAULT false NOT NULL, deduplicated boolean DEFAULT false NOT NULL,
"position" integer,
uuid uuid, uuid uuid,
overridden_uuid uuid, overridden_uuid uuid,
CONSTRAINT check_b9508c6df8 CHECK ((char_length(project_fingerprint) <= 40)) CONSTRAINT check_b9508c6df8 CHECK ((char_length(project_fingerprint) <= 40))
...@@ -27553,8 +27552,6 @@ CREATE INDEX index_security_findings_on_project_fingerprint ON security_findings ...@@ -27553,8 +27552,6 @@ CREATE INDEX index_security_findings_on_project_fingerprint ON security_findings
CREATE INDEX index_security_findings_on_scan_id_and_deduplicated ON security_findings USING btree (scan_id, deduplicated); CREATE INDEX index_security_findings_on_scan_id_and_deduplicated ON security_findings USING btree (scan_id, deduplicated);
CREATE UNIQUE INDEX index_security_findings_on_scan_id_and_position ON security_findings USING btree (scan_id, "position");
CREATE INDEX index_security_findings_on_scanner_id ON security_findings USING btree (scanner_id); CREATE INDEX index_security_findings_on_scanner_id ON security_findings USING btree (scanner_id);
CREATE INDEX index_security_findings_on_severity ON security_findings USING btree (severity); CREATE INDEX index_security_findings_on_severity ON security_findings USING btree (severity);
# frozen_string_literal: true
require 'spec_helper'
require_migration!('drop_position_from_security_findings')
RSpec.describe DropPositionFromSecurityFindings do
let(:events) { table(:security_findings) }
it 'correctly migrates up and down' do
reversible_migration do |migration|
migration.before -> {
expect(events.column_names).to include('position')
}
migration.after -> {
events.reset_column_information
expect(events.column_names).not_to include('position')
}
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment