Add indicies to points latitude longitude

This commit is contained in:
Eugene Burmakin 2024-03-17 18:16:45 +01:00
parent 1f3ee41bcb
commit 6f9d23017b
6 changed files with 22 additions and 31 deletions

View file

@ -11,7 +11,6 @@ gem 'puma'
gem 'pundit'
gem 'rails'
gem 'sprockets-rails'
gem 'strong_migrations'
gem 'stimulus-rails'
gem 'tailwindcss-rails'
gem 'turbo-rails'

View file

@ -279,8 +279,6 @@ GEM
stimulus-rails (1.3.3)
railties (>= 6.0.0)
stringio (3.1.0)
strong_migrations (1.8.0)
activerecord (>= 5.2)
tailwindcss-rails (2.3.0-aarch64-linux)
railties (>= 6.0.0)
tailwindcss-rails (2.3.0-arm64-darwin)
@ -335,7 +333,6 @@ DEPENDENCIES
simplecov
sprockets-rails
stimulus-rails
strong_migrations
tailwindcss-rails
turbo-rails
tzinfo-data

View file

@ -0,0 +1,15 @@
# config/initializers/geocoder.rb
Geocoder.configure(
# geocoding service request timeout, in seconds (default 3):
# timeout: 5,
# set default units to kilometers:
units: :km,
# caching (see Caching section below for details):
cache: Redis.new,
cache_options: {
expiration: 1.day, # Defaults to `nil`
# prefix: "another_key:" # Defaults to `geocoder:`
}
)

View file

@ -1,26 +0,0 @@
# Mark existing migrations as safe
StrongMigrations.start_after = 20230203144254
# Set timeouts for migrations
# If you use PgBouncer in transaction mode, delete these lines and set timeouts on the database user
StrongMigrations.lock_timeout = 10.seconds
StrongMigrations.statement_timeout = 1.hour
# Analyze tables after indexes are added
# Outdated statistics can sometimes hurt performance
StrongMigrations.auto_analyze = true
# Set the version of the production database
# so the right checks are run in development
# StrongMigrations.target_version = 10
# Add custom checks
# StrongMigrations.add_check do |method, args|
# if method == :add_index && args[0].to_s == "users"
# stop! "No more indexes on the users table"
# end
# end
# Make some operations safe by default
# See https://github.com/ankane/strong_migrations#safe-by-default
# StrongMigrations.safe_by_default = true

View file

@ -0,0 +1,5 @@
class AddIndiciesToPointsLatitudeLongitude < ActiveRecord::Migration[7.1]
def change
add_index :points, [:latitude, :longitude]
end
end

3
db/schema.rb generated
View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.1].define(version: 2024_03_15_215423) do
ActiveRecord::Schema[7.1].define(version: 2024_03_17_171559) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -57,6 +57,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_03_15_215423) do
t.index ["connection"], name: "index_points_on_connection"
t.index ["country"], name: "index_points_on_country"
t.index ["import_id"], name: "index_points_on_import_id"
t.index ["latitude", "longitude"], name: "index_points_on_latitude_and_longitude"
t.index ["trigger"], name: "index_points_on_trigger"
end