Commit 0907686e authored by Tiger Watson's avatar Tiger Watson

Merge branch 'rename-instance-statistics-measurements-table' into 'master'

Rename instance_statistics_measurements_table

See merge request gitlab-org/gitlab!62797
parents 8deb6891 a29bffcd
......@@ -3,7 +3,7 @@
module Analytics
module UsageTrends
class Measurement < ApplicationRecord
self.table_name = 'analytics_instance_statistics_measurements'
self.table_name = 'analytics_usage_trends_measurements'
enum identifier: {
projects: 1,
......
# frozen_string_literal: true
class RenameInstanceStatisticsMeasurements < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
def up
rename_table_safely(:analytics_instance_statistics_measurements, :analytics_usage_trends_measurements)
end
def down
undo_rename_table_safely(:analytics_instance_statistics_measurements, :analytics_usage_trends_measurements)
end
end
# frozen_string_literal: true
class FinalizeRenameInstanceStatisticsMeasurements < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
def up
finalize_table_rename(:analytics_instance_statistics_measurements, :analytics_usage_trends_measurements)
end
def down
undo_finalize_table_rename(:analytics_instance_statistics_measurements, :analytics_usage_trends_measurements)
end
end
862deb2d2845aaa114ba4c56418ae6a041d3aed3ac205cff102414423b60c969
\ No newline at end of file
9ffb8d6b93f1e994eaa9dd4b16b9250fe007903dca3901d34bf66a81b2f3ad44
\ No newline at end of file
......@@ -9155,31 +9155,31 @@ CREATE SEQUENCE analytics_devops_adoption_snapshots_id_seq
ALTER SEQUENCE analytics_devops_adoption_snapshots_id_seq OWNED BY analytics_devops_adoption_snapshots.id;
CREATE TABLE analytics_instance_statistics_measurements (
CREATE TABLE analytics_language_trend_repository_languages (
file_count integer DEFAULT 0 NOT NULL,
programming_language_id bigint NOT NULL,
project_id bigint NOT NULL,
loc integer DEFAULT 0 NOT NULL,
bytes integer DEFAULT 0 NOT NULL,
percentage smallint DEFAULT 0 NOT NULL,
snapshot_date date NOT NULL
);
CREATE TABLE analytics_usage_trends_measurements (
id bigint NOT NULL,
count bigint NOT NULL,
recorded_at timestamp with time zone NOT NULL,
identifier smallint NOT NULL
);
CREATE SEQUENCE analytics_instance_statistics_measurements_id_seq
CREATE SEQUENCE analytics_usage_trends_measurements_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE analytics_instance_statistics_measurements_id_seq OWNED BY analytics_instance_statistics_measurements.id;
CREATE TABLE analytics_language_trend_repository_languages (
file_count integer DEFAULT 0 NOT NULL,
programming_language_id bigint NOT NULL,
project_id bigint NOT NULL,
loc integer DEFAULT 0 NOT NULL,
bytes integer DEFAULT 0 NOT NULL,
percentage smallint DEFAULT 0 NOT NULL,
snapshot_date date NOT NULL
);
ALTER SEQUENCE analytics_usage_trends_measurements_id_seq OWNED BY analytics_usage_trends_measurements.id;
CREATE TABLE appearances (
id integer NOT NULL,
......@@ -19507,7 +19507,7 @@ ALTER TABLE ONLY analytics_devops_adoption_segments ALTER COLUMN id SET DEFAULT
ALTER TABLE ONLY analytics_devops_adoption_snapshots ALTER COLUMN id SET DEFAULT nextval('analytics_devops_adoption_snapshots_id_seq'::regclass);
ALTER TABLE ONLY analytics_instance_statistics_measurements ALTER COLUMN id SET DEFAULT nextval('analytics_instance_statistics_measurements_id_seq'::regclass);
ALTER TABLE ONLY analytics_usage_trends_measurements ALTER COLUMN id SET DEFAULT nextval('analytics_usage_trends_measurements_id_seq'::regclass);
ALTER TABLE ONLY appearances ALTER COLUMN id SET DEFAULT nextval('appearances_id_seq'::regclass);
......@@ -20598,12 +20598,12 @@ ALTER TABLE ONLY analytics_devops_adoption_segments
ALTER TABLE ONLY analytics_devops_adoption_snapshots
ADD CONSTRAINT analytics_devops_adoption_snapshots_pkey PRIMARY KEY (id);
ALTER TABLE ONLY analytics_instance_statistics_measurements
ADD CONSTRAINT analytics_instance_statistics_measurements_pkey PRIMARY KEY (id);
ALTER TABLE ONLY analytics_language_trend_repository_languages
ADD CONSTRAINT analytics_language_trend_repository_languages_pkey PRIMARY KEY (programming_language_id, project_id, snapshot_date);
ALTER TABLE ONLY analytics_usage_trends_measurements
ADD CONSTRAINT analytics_usage_trends_measurements_pkey PRIMARY KEY (id);
ALTER TABLE ONLY appearances
ADD CONSTRAINT appearances_pkey PRIMARY KEY (id);
......@@ -23853,7 +23853,7 @@ CREATE INDEX index_on_id_partial_with_legacy_storage ON projects USING btree (id
CREATE INDEX index_on_identities_lower_extern_uid_and_provider ON identities USING btree (lower((extern_uid)::text), provider);
CREATE UNIQUE INDEX index_on_instance_statistics_recorded_at_and_identifier ON analytics_instance_statistics_measurements USING btree (identifier, recorded_at);
CREATE UNIQUE INDEX index_on_instance_statistics_recorded_at_and_identifier ON analytics_usage_trends_measurements USING btree (identifier, recorded_at);
CREATE INDEX index_on_label_links_all_columns ON label_links USING btree (target_id, label_id, target_type);
......@@ -9,7 +9,6 @@ module Gitlab
# 'old_name' => 'new_name'
# }.freeze
TABLES_TO_BE_RENAMED = {
'analytics_instance_statistics_measurements' => 'analytics_usage_trends_measurements',
'services' => 'integrations'
}.freeze
......
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