Add unique constraints on domain_hosts (#911)

* Add unique constraints on domain_hosts

Add unique constraints on DomainHost (child of DomainBase) and
DomainHistoryHost (child of DomainHistory). DomainHost is non-entity
embedded object and Hibernate does not define indexes automatically.

This should improve read and write performance of the parent entities.
This commit is contained in:
Weimin Yu 2020-12-21 18:22:24 -05:00 committed by GitHub
parent 59e288fac7
commit 15b6b699cb
8 changed files with 174 additions and 55 deletions

View file

@ -1428,6 +1428,22 @@ ALTER TABLE ONLY public."RegistryLock"
ADD CONSTRAINT idx_registry_lock_repo_id_revision_id UNIQUE (repo_id, revision_id);
--
-- Name: DomainHost ukat9erbh52e4lg3jw6ai9wkjj9; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."DomainHost"
ADD CONSTRAINT ukat9erbh52e4lg3jw6ai9wkjj9 UNIQUE (domain_repo_id, host_repo_id);
--
-- Name: DomainHistoryHost ukt2e7ae3t8gcsxd13wjx2ka7ij; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."DomainHistoryHost"
ADD CONSTRAINT ukt2e7ae3t8gcsxd13wjx2ka7ij UNIQUE (domain_history_history_revision_id, domain_history_domain_repo_id, host_repo_id);
--
-- Name: allocation_token_domain_name_idx; Type: INDEX; Schema: public; Owner: -
--