From 152446698694077fd5b91830ffb243056a7afd99 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sat, 7 Oct 2023 15:20:14 +0100 Subject: [PATCH] Add a primary key to the changeset_tags table --- ...007141103_add_primary_key_to_changeset_tags.rb | 6 ++++++ db/structure.sql | 15 ++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 db/migrate/20231007141103_add_primary_key_to_changeset_tags.rb diff --git a/db/migrate/20231007141103_add_primary_key_to_changeset_tags.rb b/db/migrate/20231007141103_add_primary_key_to_changeset_tags.rb new file mode 100644 index 00000000000..640bec5f937 --- /dev/null +++ b/db/migrate/20231007141103_add_primary_key_to_changeset_tags.rb @@ -0,0 +1,6 @@ +class AddPrimaryKeyToChangesetTags < ActiveRecord::Migration[7.0] + def change + add_primary_key :changeset_tags, [:changeset_id, :k] + remove_index :changeset_tags, [:changeset_id] + end +end diff --git a/db/structure.sql b/db/structure.sql index bd65755f2bb..e88d4b04669 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -1838,6 +1838,14 @@ ALTER TABLE ONLY public.changeset_comments ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id); +-- +-- Name: changeset_tags changeset_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.changeset_tags + ADD CONSTRAINT changeset_tags_pkey PRIMARY KEY (changeset_id, k); + + -- -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -2205,13 +2213,6 @@ ALTER TABLE ONLY public.ways CREATE INDEX acls_k_idx ON public.acls USING btree (k); --- --- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id); - - -- -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: - --