diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20200303181648_add_healthy_to_clusters_applications_prometheus.rb | 15 | ||||
-rw-r--r-- | db/migrate/20200323134519_add_api_indexes_for_archived_projects.rb | 27 | ||||
-rw-r--r-- | db/structure.sql | 9 |
3 files changed, 50 insertions, 1 deletions
diff --git a/db/migrate/20200303181648_add_healthy_to_clusters_applications_prometheus.rb b/db/migrate/20200303181648_add_healthy_to_clusters_applications_prometheus.rb new file mode 100644 index 00000000000..402cdbbdc14 --- /dev/null +++ b/db/migrate/20200303181648_add_healthy_to_clusters_applications_prometheus.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddHealthyToClustersApplicationsPrometheus < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + # Default is null to indicate that a health check has not run for a project + # For now, health checks will only run on monitor demo projects + add_column :clusters_applications_prometheus, :healthy, :boolean + end + + def down + remove_column :clusters_applications_prometheus, :healthy + end +end diff --git a/db/migrate/20200323134519_add_api_indexes_for_archived_projects.rb b/db/migrate/20200323134519_add_api_indexes_for_archived_projects.rb new file mode 100644 index 00000000000..cacf427dbe4 --- /dev/null +++ b/db/migrate/20200323134519_add_api_indexes_for_archived_projects.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class AddApiIndexesForArchivedProjects < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + PUBLIC_AND_ARCHIVED_INDEX_NAME = "index_projects_api_created_at_id_for_archived_vis20" + ARCHIVED_INDEX_NAME = "index_projects_api_created_at_id_for_archived" + + disable_ddl_transaction! + + def up + add_concurrent_index :projects, [:created_at, :id], + where: "archived = true AND visibility_level = 20 AND pending_delete = false", + name: PUBLIC_AND_ARCHIVED_INDEX_NAME + + add_concurrent_index :projects, [:created_at, :id], where: "archived = true AND pending_delete = false", + name: ARCHIVED_INDEX_NAME + end + + def down + remove_concurrent_index_by_name :projects, ARCHIVED_INDEX_NAME + + remove_concurrent_index_by_name :projects, PUBLIC_AND_ARCHIVED_INDEX_NAME + end +end diff --git a/db/structure.sql b/db/structure.sql index 6301ec6df80..adaa0a594e6 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -1748,7 +1748,8 @@ CREATE TABLE public.clusters_applications_prometheus ( updated_at timestamp with time zone NOT NULL, last_update_started_at timestamp with time zone, encrypted_alert_manager_token character varying, - encrypted_alert_manager_token_iv character varying + encrypted_alert_manager_token_iv character varying, + healthy boolean ); CREATE SEQUENCE public.clusters_applications_prometheus_id_seq @@ -9654,6 +9655,10 @@ CREATE UNIQUE INDEX index_project_tracing_settings_on_project_id ON public.proje CREATE INDEX index_projects_api_created_at_id_desc ON public.projects USING btree (created_at, id DESC); +CREATE INDEX index_projects_api_created_at_id_for_archived ON public.projects USING btree (created_at, id) WHERE ((archived = true) AND (pending_delete = false)); + +CREATE INDEX index_projects_api_created_at_id_for_archived_vis20 ON public.projects USING btree (created_at, id) WHERE ((archived = true) AND (visibility_level = 20) AND (pending_delete = false)); + CREATE INDEX index_projects_api_last_activity_at_id_desc ON public.projects USING btree (last_activity_at, id DESC); CREATE INDEX index_projects_api_name_id_desc ON public.projects USING btree (name, id DESC); @@ -12731,6 +12736,7 @@ COPY "schema_migrations" (version) FROM STDIN; 20200302152516 20200303055348 20200303074328 +20200303181648 20200304085423 20200304090155 20200304121828 @@ -12793,6 +12799,7 @@ COPY "schema_migrations" (version) FROM STDIN; 20200320123839 20200323075043 20200323122201 +20200323134519 20200324115359 \. |