Commit 4fd356ba authored by Adam Hegyi's avatar Adam Hegyi

Merge branch 'mo-drop-unused-ci-tables' into 'master'

Drop unused ci_test_cases and ci_test_case_failures tables

See merge request gitlab-org/gitlab!67180
parents 3fc2bf93 575cf874
# frozen_string_literal: true
class RemoveForeignKeysFromCiTestCaseFailures < ActiveRecord::Migration[6.1]
include Gitlab::Database::MigrationHelpers
TABLE_NAME = :ci_test_case_failures
disable_ddl_transaction!
def up
with_lock_retries do
remove_foreign_key_if_exists(TABLE_NAME, column: :build_id)
end
with_lock_retries do
remove_foreign_key_if_exists(TABLE_NAME, column: :test_case_id)
end
end
def down
add_concurrent_foreign_key(TABLE_NAME, :ci_builds, column: :build_id, on_delete: :cascade)
add_concurrent_foreign_key(TABLE_NAME, :ci_test_cases, column: :test_case_id, on_delete: :cascade)
end
end
# frozen_string_literal: true
class RemoveForeignKeysFromCiTestCases < ActiveRecord::Migration[6.1]
include Gitlab::Database::MigrationHelpers
TABLE_NAME = :ci_test_cases
disable_ddl_transaction!
def up
with_lock_retries do
remove_foreign_key_if_exists(TABLE_NAME, column: :project_id)
end
end
def down
add_concurrent_foreign_key(TABLE_NAME, :projects, column: :project_id, on_delete: :cascade)
end
end
# frozen_string_literal: true
class DropCiTestCaseFailuresTable < ActiveRecord::Migration[6.1]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
drop_table :ci_test_case_failures
end
def down
create_table :ci_test_case_failures do |t|
t.datetime_with_timezone :failed_at
t.bigint :test_case_id, null: false
t.bigint :build_id, null: false
t.index [:test_case_id, :failed_at, :build_id], name: 'index_test_case_failures_unique_columns', unique: true, order: { failed_at: :desc }
t.index :build_id
end
end
end
# frozen_string_literal: true
class DropCiTestCasesTable < ActiveRecord::Migration[6.1]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
drop_table :ci_test_cases
end
def down
create_table_with_constraints :ci_test_cases do |t|
t.bigint :project_id, null: false
t.text :key_hash, null: false
t.text_limit :key_hash, 64
t.index [:project_id, :key_hash], unique: true
end
end
end
22a64ce9a8cbebd2024908cc74cc92a50fb6ccaa1580ebea3be60d3659c48fa0
\ No newline at end of file
6ed7827f6f911dbb40637ac056298877b709fb7356bc9ee3a366cceb48268646
\ No newline at end of file
3cb0c88fddfec66c0d89c4c1f34d0538be88a44f2039e6c542c5282b293ce019
\ No newline at end of file
d983a765482b368bd7a238b3b75fc9b0a45310f295953ea053ee4c42785e8684
\ No newline at end of file
......@@ -11340,38 +11340,6 @@ CREATE SEQUENCE ci_subscriptions_projects_id_seq
ALTER SEQUENCE ci_subscriptions_projects_id_seq OWNED BY ci_subscriptions_projects.id;
CREATE TABLE ci_test_case_failures (
id bigint NOT NULL,
failed_at timestamp with time zone,
test_case_id bigint NOT NULL,
build_id bigint NOT NULL
);
CREATE SEQUENCE ci_test_case_failures_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE ci_test_case_failures_id_seq OWNED BY ci_test_case_failures.id;
CREATE TABLE ci_test_cases (
id bigint NOT NULL,
project_id bigint NOT NULL,
key_hash text NOT NULL,
CONSTRAINT check_dd3c5d1c15 CHECK ((char_length(key_hash) <= 64))
);
CREATE SEQUENCE ci_test_cases_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE ci_test_cases_id_seq OWNED BY ci_test_cases.id;
CREATE TABLE ci_trigger_requests (
id integer NOT NULL,
trigger_id integer NOT NULL,
......@@ -20074,10 +20042,6 @@ ALTER TABLE ONLY ci_stages ALTER COLUMN id SET DEFAULT nextval('ci_stages_id_seq
ALTER TABLE ONLY ci_subscriptions_projects ALTER COLUMN id SET DEFAULT nextval('ci_subscriptions_projects_id_seq'::regclass);
ALTER TABLE ONLY ci_test_case_failures ALTER COLUMN id SET DEFAULT nextval('ci_test_case_failures_id_seq'::regclass);
ALTER TABLE ONLY ci_test_cases ALTER COLUMN id SET DEFAULT nextval('ci_test_cases_id_seq'::regclass);
ALTER TABLE ONLY ci_trigger_requests ALTER COLUMN id SET DEFAULT nextval('ci_trigger_requests_id_seq'::regclass);
ALTER TABLE ONLY ci_triggers ALTER COLUMN id SET DEFAULT nextval('ci_triggers_id_seq'::regclass);
......@@ -21311,12 +21275,6 @@ ALTER TABLE ONLY ci_stages
ALTER TABLE ONLY ci_subscriptions_projects
ADD CONSTRAINT ci_subscriptions_projects_pkey PRIMARY KEY (id);
ALTER TABLE ONLY ci_test_case_failures
ADD CONSTRAINT ci_test_case_failures_pkey PRIMARY KEY (id);
ALTER TABLE ONLY ci_test_cases
ADD CONSTRAINT ci_test_cases_pkey PRIMARY KEY (id);
ALTER TABLE ONLY ci_trigger_requests
ADD CONSTRAINT ci_trigger_requests_pkey PRIMARY KEY (id);
......@@ -23397,10 +23355,6 @@ CREATE INDEX index_ci_subscriptions_projects_on_upstream_project_id ON ci_subscr
CREATE UNIQUE INDEX index_ci_subscriptions_projects_unique_subscription ON ci_subscriptions_projects USING btree (downstream_project_id, upstream_project_id);
CREATE INDEX index_ci_test_case_failures_on_build_id ON ci_test_case_failures USING btree (build_id);
CREATE UNIQUE INDEX index_ci_test_cases_on_project_id_and_key_hash ON ci_test_cases USING btree (project_id, key_hash);
CREATE INDEX index_ci_trigger_requests_on_commit_id ON ci_trigger_requests USING btree (commit_id);
CREATE INDEX index_ci_trigger_requests_on_trigger_id_and_id ON ci_trigger_requests USING btree (trigger_id, id DESC);
......@@ -25205,8 +25159,6 @@ CREATE UNIQUE INDEX index_terraform_states_on_project_id_and_name ON terraform_s
CREATE UNIQUE INDEX index_terraform_states_on_uuid ON terraform_states USING btree (uuid);
CREATE UNIQUE INDEX index_test_case_failures_unique_columns ON ci_test_case_failures USING btree (test_case_id, failed_at DESC, build_id);
CREATE INDEX index_timelogs_on_issue_id ON timelogs USING btree (issue_id);
CREATE INDEX index_timelogs_on_merge_request_id ON timelogs USING btree (merge_request_id);
......@@ -25913,9 +25865,6 @@ ALTER TABLE ONLY design_management_designs_versions
ALTER TABLE ONLY terraform_state_versions
ADD CONSTRAINT fk_04b91e4a9f FOREIGN KEY (ci_build_id) REFERENCES ci_builds(id) ON DELETE SET NULL;
ALTER TABLE ONLY ci_test_cases
ADD CONSTRAINT fk_0526c30ded FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY issues
ADD CONSTRAINT fk_05f1e72feb FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE SET NULL;
......@@ -26537,9 +26486,6 @@ ALTER TABLE ONLY ci_sources_pipelines
ALTER TABLE ONLY geo_event_log
ADD CONSTRAINT fk_d5af95fcd9 FOREIGN KEY (lfs_object_deleted_event_id) REFERENCES geo_lfs_object_deleted_events(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_test_case_failures
ADD CONSTRAINT fk_d69404d827 FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
ALTER TABLE ONLY lists
ADD CONSTRAINT fk_d6cf4279f7 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
......@@ -28142,9 +28088,6 @@ ALTER TABLE ONLY vulnerability_finding_evidence_sources
ALTER TABLE ONLY protected_branch_unprotect_access_levels
ADD CONSTRAINT fk_rails_e9eb8dc025 FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_test_case_failures
ADD CONSTRAINT fk_rails_eab6349715 FOREIGN KEY (test_case_id) REFERENCES ci_test_cases(id) ON DELETE CASCADE;
ALTER TABLE ONLY alert_management_alert_user_mentions
ADD CONSTRAINT fk_rails_eb2de0cdef FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;
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