#
# 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
#
# 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
--- /dev/null
+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
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
);
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: -
--
('23'),
('22'),
('21'),
+('20250104140952'),
('20241023004427'),
('20241022141247'),
('20240913171951'),