From: Nenad Vujicic Date: Mon, 13 Jan 2025 12:09:04 +0000 (+0100) Subject: Adds validating of notes foreign key X-Git-Tag: live~183^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/297e8374f495d2487d42a4ad96a0f0d981ffd697 Adds validating of notes foreign key Adds migration for validation foreign key in notes table referencing users table. --- diff --git a/db/migrate/20250105154621_validate_foreign_key_on_notes.rb b/db/migrate/20250105154621_validate_foreign_key_on_notes.rb new file mode 100644 index 000000000..8ff7df9e9 --- /dev/null +++ b/db/migrate/20250105154621_validate_foreign_key_on_notes.rb @@ -0,0 +1,5 @@ +class ValidateForeignKeyOnNotes < ActiveRecord::Migration[7.2] + def change + validate_foreign_key :notes, :users + end +end diff --git a/db/structure.sql b/db/structure.sql index fe0b4e481..04b0dc17f 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -3218,7 +3218,7 @@ ALTER TABLE ONLY public.note_comments -- ALTER TABLE ONLY public.notes - ADD CONSTRAINT notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) NOT VALID; + ADD CONSTRAINT notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); -- @@ -3408,6 +3408,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('23'), ('22'), ('21'), +('20250105154621'), ('20250104140952'), ('20241023004427'), ('20241022141247'),