Skip to content

Commit

Permalink
Merge branch 'pull/5182'
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKhorev committed Sep 12, 2024
2 parents 36d72d2 + 336ad6d commit e2a6701
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ def save_new_user(email_hmac, referer = nil)
current_user.data_public = true
current_user.description = "" if current_user.description.nil?
current_user.creation_ip = request.remote_ip
current_user.creation_address = request.remote_ip
current_user.languages = http_accept_language.user_preferred_languages
current_user.terms_agreed = Time.now.utc
current_user.tou_agreed = Time.now.utc
Expand Down
2 changes: 2 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@
# tou_agreed :datetime
# diary_comments_count :integer default(0)
# note_comments_count :integer default(0)
# creation_address :inet
#
# Indexes
#
# index_users_on_creation_address (creation_address) USING gist
# users_auth_idx (auth_provider,auth_uid) UNIQUE
# users_display_name_canonical_idx (lower(NORMALIZE(display_name, NFKC)))
# users_display_name_idx (display_name) UNIQUE
Expand Down
8 changes: 8 additions & 0 deletions db/migrate/20240910175616_add_user_creation_address.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class AddUserCreationAddress < ActiveRecord::Migration[7.1]
disable_ddl_transaction!

def change
add_column :users, :creation_address, :inet
add_index :users, :creation_address, :using => :gist, :opclass => :inet_ops, :algorithm => :concurrently
end
end
11 changes: 10 additions & 1 deletion db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1499,7 +1499,8 @@ CREATE TABLE public.users (
home_tile bigint,
tou_agreed timestamp without time zone,
diary_comments_count integer DEFAULT 0,
note_comments_count integer DEFAULT 0
note_comments_count integer DEFAULT 0,
creation_address inet
);


Expand Down Expand Up @@ -2603,6 +2604,13 @@ CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (use
CREATE UNIQUE INDEX index_user_mutes_on_owner_id_and_subject_id ON public.user_mutes USING btree (owner_id, subject_id);


--
-- Name: index_users_on_creation_address; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_users_on_creation_address ON public.users USING gist (creation_address inet_ops);


--
-- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
--
Expand Down Expand Up @@ -3349,6 +3357,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('23'),
('22'),
('21'),
('20240910175616'),
('20240822121603'),
('20240813070506'),
('20240724194738'),
Expand Down

0 comments on commit e2a6701

Please sign in to comment.