diff --git a/changelogs/unreleased/297664-maintain-data-parity-between-experimentuser-experimentsubject.yml b/changelogs/unreleased/297664-maintain-data-parity-between-experimentuser-experimentsubject.yml new file mode 100644 index 0000000000000000000000000000000000000000..0227569839ec5e8a50aac7645b5e8ede3b1cd254 --- /dev/null +++ b/changelogs/unreleased/297664-maintain-data-parity-between-experimentuser-experimentsubject.yml @@ -0,0 +1,6 @@ +--- +title: Add converted_at(timestamp) & context(jsonb) columns to the experiment_subjects + table +merge_request: 51659 +author: +type: changed diff --git a/db/migrate/20210113231532_add_converted_at_to_experiment_subjects.rb b/db/migrate/20210113231532_add_converted_at_to_experiment_subjects.rb new file mode 100644 index 0000000000000000000000000000000000000000..25571b25af98334d212eb6d9dd0bcfdce1b57c07 --- /dev/null +++ b/db/migrate/20210113231532_add_converted_at_to_experiment_subjects.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddConvertedAtToExperimentSubjects < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :experiment_subjects, :converted_at, :datetime_with_timezone + end +end diff --git a/db/migrate/20210113231546_add_context_to_experiment_subjects.rb b/db/migrate/20210113231546_add_context_to_experiment_subjects.rb new file mode 100644 index 0000000000000000000000000000000000000000..7fac45e9952ec302960ede676e5279630a54eb3e --- /dev/null +++ b/db/migrate/20210113231546_add_context_to_experiment_subjects.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddContextToExperimentSubjects < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :experiment_subjects, :context, :jsonb, default: {}, null: false + end +end diff --git a/db/schema_migrations/20210113231532 b/db/schema_migrations/20210113231532 new file mode 100644 index 0000000000000000000000000000000000000000..eb39ac161ba226bf0113785065bf6f90fd910e2c --- /dev/null +++ b/db/schema_migrations/20210113231532 @@ -0,0 +1 @@ +1a430ce6d137ee896cbd37bb822ccd18c9e87204b765b1192928dd82efb28602 \ No newline at end of file diff --git a/db/schema_migrations/20210113231546 b/db/schema_migrations/20210113231546 new file mode 100644 index 0000000000000000000000000000000000000000..3286727b72caf33648b5ea6d9d758cf2d8fbeeef --- /dev/null +++ b/db/schema_migrations/20210113231546 @@ -0,0 +1 @@ +5d7bbf376acbf5679d111866e70b69eebba26a487a9e7d6bd571f15dc423e3e3 \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 5662bba5fe4070da353e011882272b1b8928b8e0..21035098449f978bb22838015f0cd29666ca305f 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -12261,6 +12261,8 @@ CREATE TABLE experiment_subjects ( variant smallint DEFAULT 0 NOT NULL, created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, + converted_at timestamp with time zone, + context jsonb DEFAULT '{}'::jsonb NOT NULL, CONSTRAINT chk_has_one_subject CHECK ((num_nonnulls(user_id, group_id, project_id) = 1)) ); diff --git a/spec/db/schema_spec.rb b/spec/db/schema_spec.rb index 3087beb13263204f5202e5219c101020920b65b8..efbf6e7baaba165b1b9934b52c0875e4e16d5009 100644 --- a/spec/db/schema_spec.rb +++ b/spec/db/schema_spec.rb @@ -184,6 +184,7 @@ "ApplicationSetting" => %w[repository_storages_weighted], "AlertManagement::Alert" => %w[payload], "Ci::BuildMetadata" => %w[config_options config_variables], + "ExperimentSubject" => %w[context], "ExperimentUser" => %w[context], "Geo::Event" => %w[payload], "GeoNodeStatus" => %w[status],