Merge remote-tracking branch 'origin/master' into feature/google-records-json-improvement

This commit is contained in:
Eugene Burmakin 2025-01-21 16:04:00 +01:00
commit d3a84bf652
4 changed files with 27 additions and 4 deletions

View file

@ -1 +1 @@
0.23.0 0.23.2

View file

@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/). and this project adheres to [Semantic Versioning](http://semver.org/).
# 0.23.2 - 2025-01-21
### Fixed
- Add index only if it doesn't exist.
# 0.23.1 - 2025-01-21
### Fixed
- Renamed unique index on points to `unique_points_lat_long_timestamp_user_id_index` to fix naming conflict with `unique_points_index`.
# 0.23.0 - 2025-01-20 # 0.23.0 - 2025-01-20
## ⚠️ IMPORTANT ⚠️ ## ⚠️ IMPORTANT ⚠️

View file

@ -4,13 +4,24 @@ class AddUniqueIndexToPoints < ActiveRecord::Migration[8.0]
disable_ddl_transaction! disable_ddl_transaction!
def up def up
return if index_exists?(
:points, %i[latitude longitude timestamp user_id],
name: 'unique_points_lat_long_timestamp_user_id_index'
)
add_index :points, %i[latitude longitude timestamp user_id], add_index :points, %i[latitude longitude timestamp user_id],
unique: true, unique: true,
name: 'unique_points_index', name: 'unique_points_lat_long_timestamp_user_id_index',
algorithm: :concurrently algorithm: :concurrently
end end
def down def down
remove_index :points, name: 'unique_points_index' return unless index_exists?(
:points, %i[latitude longitude timestamp user_id],
name: 'unique_points_lat_long_timestamp_user_id_index'
)
remove_index :points, %i[latitude longitude timestamp user_id],
name: 'unique_points_lat_long_timestamp_user_id_index'
end end
end end

2
db/schema.rb generated
View file

@ -168,7 +168,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_01_20_154555) do
t.index ["external_track_id"], name: "index_points_on_external_track_id" t.index ["external_track_id"], name: "index_points_on_external_track_id"
t.index ["geodata"], name: "index_points_on_geodata", using: :gin t.index ["geodata"], name: "index_points_on_geodata", using: :gin
t.index ["import_id"], name: "index_points_on_import_id" t.index ["import_id"], name: "index_points_on_import_id"
t.index ["latitude", "longitude", "timestamp", "user_id"], name: "unique_points_index", unique: true t.index ["latitude", "longitude", "timestamp", "user_id"], name: "unique_points_lat_long_timestamp_user_id_index", unique: true
t.index ["latitude", "longitude"], name: "index_points_on_latitude_and_longitude" t.index ["latitude", "longitude"], name: "index_points_on_latitude_and_longitude"
t.index ["reverse_geocoded_at"], name: "index_points_on_reverse_geocoded_at" t.index ["reverse_geocoded_at"], name: "index_points_on_reverse_geocoded_at"
t.index ["timestamp"], name: "index_points_on_timestamp" t.index ["timestamp"], name: "index_points_on_timestamp"