Commit 5cd3394b authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch '329535-deployments-bigint' into 'master'

Prepare deployments table for bigint conversion

See merge request gitlab-org/gitlab!62459
parents 912e24e6 f54f4c1f
......@@ -8,6 +8,9 @@ class Deployment < ApplicationRecord
include Importable
include Gitlab::Utils::StrongMemoize
include FastDestroyAll
include IgnorableColumns
ignore_column :deployable_id_convert_to_bigint, remove_with: '14.2', remove_after: '2021-08-22'
belongs_to :project, required: true
belongs_to :environment, required: true
......
# frozen_string_literal: true
class InitializeConversionOfDeploymentsToBigint < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
TABLE = :deployments
COLUMNS = %i(deployable_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 BackfillDeploymentsForBigintConversion < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
TABLE = :deployments
COLUMNS = %i(deployable_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
a2ce644df46a13d65eb0d01931eeb8e9f43967daadf73eed2f033b6c275ca57d
\ No newline at end of file
f085c9a7fc2209cf4d3797cda55c2be76b462eff456e7bf92de4545e0b988053
\ No newline at end of file
......@@ -143,6 +143,15 @@ BEGIN
END;
$$;
CREATE FUNCTION trigger_77f5e1d20482() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."deployable_id_convert_to_bigint" := NEW."deployable_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_8485e97c00e3() RETURNS trigger
LANGUAGE plpgsql
AS $$
......@@ -12288,7 +12297,8 @@ CREATE TABLE deployments (
on_stop character varying,
status smallint NOT NULL,
finished_at timestamp with time zone,
cluster_id integer
cluster_id integer,
deployable_id_convert_to_bigint bigint
);
CREATE SEQUENCE deployments_id_seq
......@@ -25280,6 +25290,8 @@ CREATE TRIGGER trigger_51ab7cef8934 BEFORE INSERT OR UPDATE ON ci_builds_runner_
CREATE TRIGGER trigger_69523443cc10 BEFORE INSERT OR UPDATE ON events FOR EACH ROW EXECUTE FUNCTION trigger_69523443cc10();
CREATE TRIGGER trigger_77f5e1d20482 BEFORE INSERT OR UPDATE ON deployments FOR EACH ROW EXECUTE FUNCTION trigger_77f5e1d20482();
CREATE TRIGGER trigger_8485e97c00e3 BEFORE INSERT OR UPDATE ON ci_sources_pipelines FOR EACH ROW EXECUTE FUNCTION trigger_8485e97c00e3();
CREATE TRIGGER trigger_8487d4de3e7b BEFORE INSERT OR UPDATE ON ci_builds_metadata FOR EACH ROW EXECUTE FUNCTION trigger_8487d4de3e7b();
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