Commit e046d93c authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Prepare geo_job_artifact_deleted_events table

Adds bigint column and triggers to prepare for bigint conversion

Changelog: other
MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62463
parent edaad05e
# frozen_string_literal: true
class InitializeConversionOfGeoJobArtifactDeletedEventsToBigint < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
TABLE = :geo_job_artifact_deleted_events
COLUMNS = %i(job_artifact_id)
def up
initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
def down
revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
end
# frozen_string_literal: true
class BackfillGeoJobArtifactDeletedEventsForBigintConversion < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
TABLE = :geo_job_artifact_deleted_events
COLUMNS = %i(job_artifact_id)
def up
backfill_conversion_of_integer_to_bigint TABLE, COLUMNS
end
def down
revert_backfill_conversion_of_integer_to_bigint TABLE, COLUMNS
end
end
6568aa11d3652fb7ee23d2e6622a1038d891914f629438608993ff0d8b46b748
\ No newline at end of file
1a877c384c1e4e9e28a64c8c521aa72965c54d528044b076efdc75aeeb83d796
\ No newline at end of file
......@@ -199,6 +199,15 @@ BEGIN
END;
$$;
CREATE FUNCTION trigger_f1ca8ec18d78() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."job_artifact_id_convert_to_bigint" := NEW."job_artifact_id";
RETURN NEW;
END;
$$;
CREATE TABLE audit_events (
id bigint NOT NULL,
author_id integer NOT NULL,
......@@ -13044,7 +13053,8 @@ ALTER SEQUENCE geo_hashed_storage_migrated_events_id_seq OWNED BY geo_hashed_sto
CREATE TABLE geo_job_artifact_deleted_events (
id bigint NOT NULL,
job_artifact_id integer NOT NULL,
file_path character varying NOT NULL
file_path character varying NOT NULL,
job_artifact_id_convert_to_bigint bigint DEFAULT 0 NOT NULL
);
CREATE SEQUENCE geo_job_artifact_deleted_events_id_seq
......@@ -25289,6 +25299,8 @@ CREATE TRIGGER trigger_be1804f21693 BEFORE INSERT OR UPDATE ON ci_job_artifacts
CREATE TRIGGER trigger_cf2f9e35f002 BEFORE INSERT OR UPDATE ON ci_build_trace_chunks FOR EACH ROW EXECUTE FUNCTION trigger_cf2f9e35f002();
CREATE TRIGGER trigger_f1ca8ec18d78 BEFORE INSERT OR UPDATE ON geo_job_artifact_deleted_events FOR EACH ROW EXECUTE FUNCTION trigger_f1ca8ec18d78();
CREATE TRIGGER trigger_has_external_issue_tracker_on_delete AFTER DELETE ON services FOR EACH ROW WHEN ((((old.category)::text = 'issue_tracker'::text) AND (old.active = true) AND (old.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_issue_tracker();
CREATE TRIGGER trigger_has_external_issue_tracker_on_insert AFTER INSERT ON services FOR EACH ROW WHEN ((((new.category)::text = 'issue_tracker'::text) AND (new.active = true) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_issue_tracker();
......@@ -5,6 +5,9 @@ module Geo
include Geo::Model
include Geo::Eventable
include BulkInsertSafe
include IgnorableColumns
ignore_column :job_artifact_id_convert_to_bigint, remove_with: '14.2', remove_after: '2021-08-22'
belongs_to :job_artifact, class_name: 'Ci::JobArtifact'
......
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