From: Tom Hughes Date: Thu, 16 Jan 2025 18:38:36 +0000 (+0000) Subject: Merge remote-tracking branch 'upstream/pull/5499' X-Git-Tag: live~419 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/0ab8d954ad6d6e4cee5c1238973b8f693c788fcb?hp=283e7b975b5a80d3f3e8091ce83e8f89b33bb06c Merge remote-tracking branch 'upstream/pull/5499' --- diff --git a/app/models/note.rb b/app/models/note.rb index d23f458e5..17b57c0fa 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -2,14 +2,17 @@ # # Table name: notes # -# id :bigint(8) not null, primary key -# latitude :integer not null -# longitude :integer not null -# tile :bigint(8) not null -# updated_at :datetime not null -# created_at :datetime not null -# status :enum not null -# closed_at :datetime +# id :bigint(8) not null, primary key +# latitude :integer not null +# longitude :integer not null +# tile :bigint(8) not null +# updated_at :datetime not null +# created_at :datetime not null +# status :enum not null +# closed_at :datetime +# description :text default(""), not null +# user_id :bigint(8) +# user_ip :inet # # Indexes # @@ -17,6 +20,10 @@ # notes_tile_status_idx (tile,status) # notes_updated_at_idx (updated_at) # +# Foreign Keys +# +# notes_user_id_fkey (user_id => users.id) +# class Note < ApplicationRecord include GeoRecord diff --git a/db/migrate/20250104140952_add_description_to_notes.rb b/db/migrate/20250104140952_add_description_to_notes.rb new file mode 100644 index 000000000..4e0ceec21 --- /dev/null +++ b/db/migrate/20250104140952_add_description_to_notes.rb @@ -0,0 +1,9 @@ +class AddDescriptionToNotes < ActiveRecord::Migration[7.2] + def change + add_column :notes, :description, :text, :null => false, :default => "" + add_column :notes, :user_id, :bigint + add_column :notes, :user_ip, :inet + + add_foreign_key :notes, :users, :column => :user_id, :name => "notes_user_id_fkey", :validate => false + end +end diff --git a/db/structure.sql b/db/structure.sql index 9679e0b92..fe0b4e481 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -1073,7 +1073,10 @@ CREATE TABLE public.notes ( updated_at timestamp without time zone NOT NULL, created_at timestamp without time zone NOT NULL, status public.note_status_enum NOT NULL, - closed_at timestamp without time zone + closed_at timestamp without time zone, + description text DEFAULT ''::text NOT NULL, + user_id bigint, + user_ip inet ); @@ -3210,6 +3213,14 @@ ALTER TABLE ONLY public.note_comments ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id); +-- +-- Name: notes notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.notes + ADD CONSTRAINT notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) NOT VALID; + + -- -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -3397,6 +3408,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('23'), ('22'), ('21'), +('20250104140952'), ('20241023004427'), ('20241022141247'), ('20240913171951'),