Create an index for all archived columns [SCI-8162] (#5212)

Create an index for all archived columns [SCI-8162]
This commit is contained in:
Soufiane 2023-05-03 11:36:23 +02:00 committed by GitHub
parent 1b34de37ef
commit a5c8c61733
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 130 additions and 1 deletions

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
class AddMissingIndexesOnArchived < ActiveRecord::Migration[6.1]
def change
add_index :repositories, :archived
add_index :repository_rows, :archived
add_index :experiments, :archived
add_index :my_modules, :archived
add_index :projects, :archived
add_index :results, :archived
add_index :project_folders, :archived
end
end

View file

@ -453,6 +453,41 @@ CREATE SEQUENCE public.comments_id_seq
ALTER SEQUENCE public.comments_id_seq OWNED BY public.comments.id;
--
-- Name: connected_devices; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.connected_devices (
id bigint NOT NULL,
uid character varying,
name character varying,
oauth_access_token_id bigint NOT NULL,
metadata json,
last_seen_at timestamp without time zone,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: connected_devices_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.connected_devices_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: connected_devices_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.connected_devices_id_seq OWNED BY public.connected_devices.id;
--
-- Name: connections; Type: TABLE; Schema: public; Owner: -
--
@ -3514,6 +3549,13 @@ ALTER TABLE ONLY public.checklists ALTER COLUMN id SET DEFAULT nextval('public.c
ALTER TABLE ONLY public.comments ALTER COLUMN id SET DEFAULT nextval('public.comments_id_seq'::regclass);
--
-- Name: connected_devices id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.connected_devices ALTER COLUMN id SET DEFAULT nextval('public.connected_devices_id_seq'::regclass);
--
-- Name: connections id; Type: DEFAULT; Schema: public; Owner: -
--
@ -4184,6 +4226,14 @@ ALTER TABLE ONLY public.comments
ADD CONSTRAINT comments_pkey PRIMARY KEY (id);
--
-- Name: connected_devices connected_devices_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.connected_devices
ADD CONSTRAINT connected_devices_pkey PRIMARY KEY (id);
--
-- Name: connections connections_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
@ -5100,6 +5150,13 @@ CREATE INDEX index_comments_on_type ON public.comments USING btree (type);
CREATE INDEX index_comments_on_user_id ON public.comments USING btree (user_id);
--
-- Name: index_connected_devices_on_oauth_access_token_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_connected_devices_on_oauth_access_token_id ON public.connected_devices USING btree (oauth_access_token_id);
--
-- Name: index_connections_on_input_id; Type: INDEX; Schema: public; Owner: -
--
@ -5114,6 +5171,13 @@ CREATE INDEX index_connections_on_input_id ON public.connections USING btree (in
CREATE INDEX index_connections_on_output_id ON public.connections USING btree (output_id);
--
-- Name: index_experiments_on_archived; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_experiments_on_archived ON public.experiments USING btree (archived);
--
-- Name: index_experiments_on_archived_by_id; Type: INDEX; Schema: public; Owner: -
--
@ -5303,6 +5367,13 @@ CREATE INDEX index_my_module_tags_on_my_module_id ON public.my_module_tags USING
CREATE INDEX index_my_module_tags_on_tag_id ON public.my_module_tags USING btree (tag_id);
--
-- Name: index_my_modules_on_archived; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_my_modules_on_archived ON public.my_modules USING btree (archived);
--
-- Name: index_my_modules_on_archived_by_id; Type: INDEX; Schema: public; Owner: -
--
@ -5464,6 +5535,13 @@ CREATE INDEX index_on_repository_stock_unit_item_id ON public.my_module_reposito
CREATE INDEX index_on_repository_table_filter_id ON public.repository_table_filter_elements USING btree (repository_table_filter_id);
--
-- Name: index_project_folders_on_archived; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_project_folders_on_archived ON public.project_folders USING btree (archived);
--
-- Name: index_project_folders_on_name; Type: INDEX; Schema: public; Owner: -
--
@ -5485,6 +5563,13 @@ CREATE INDEX index_project_folders_on_parent_folder_id ON public.project_folders
CREATE INDEX index_project_folders_on_team_id ON public.project_folders USING btree (team_id);
--
-- Name: index_projects_on_archived; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_projects_on_archived ON public.projects USING btree (archived);
--
-- Name: index_projects_on_archived_by_id; Type: INDEX; Schema: public; Owner: -
--
@ -5835,6 +5920,13 @@ CREATE INDEX index_reports_on_team_id ON public.reports USING btree (team_id);
CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
--
-- Name: index_repositories_on_archived; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_repositories_on_archived ON public.repositories USING btree (archived);
--
-- Name: index_repositories_on_archived_by_id; Type: INDEX; Schema: public; Owner: -
--
@ -6143,6 +6235,13 @@ CREATE INDEX index_repository_number_values_on_data_text ON public.repository_nu
CREATE INDEX index_repository_number_values_on_last_modified_by_id ON public.repository_number_values USING btree (last_modified_by_id);
--
-- Name: index_repository_rows_on_archived; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_repository_rows_on_archived ON public.repository_rows USING btree (archived);
--
-- Name: index_repository_rows_on_archived_by_id; Type: INDEX; Schema: public; Owner: -
--
@ -6374,6 +6473,13 @@ CREATE INDEX index_result_texts_on_result_id ON public.result_texts USING btree
CREATE INDEX index_result_texts_on_text ON public.result_texts USING gin (public.trim_html_tags((text)::text) public.gin_trgm_ops);
--
-- Name: index_results_on_archived; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_results_on_archived ON public.results USING btree (archived);
--
-- Name: index_results_on_archived_by_id; Type: INDEX; Schema: public; Owner: -
--
@ -8273,6 +8379,14 @@ ALTER TABLE ONLY public.protocols
ADD CONSTRAINT fk_rails_dcb4ab6aa9 FOREIGN KEY (parent_id) REFERENCES public.protocols(id);
--
-- Name: connected_devices fk_rails_de3eb01e9e; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.connected_devices
ADD CONSTRAINT fk_rails_de3eb01e9e FOREIGN KEY (oauth_access_token_id) REFERENCES public.oauth_access_tokens(id);
--
-- Name: bmt_filters fk_rails_de5b654b84; Type: FK CONSTRAINT; Schema: public; Owner: -
--
@ -8685,8 +8799,10 @@ INSERT INTO "schema_migrations" (version) VALUES
('20221222123021'),
('20230120141017'),
('20230206095817'),
('20230207140811'),
('20230223142119'),
('20230227131215'),
('20230414091215');
('20230414091215'),
('20230426112548');