mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 01:01:39 -05:00
Add unique index to points with device_id and add tracker_id index
This commit is contained in:
parent
d1027e009f
commit
bfcd0ac45b
5 changed files with 56 additions and 10 deletions
17
CHANGELOG.md
17
CHANGELOG.md
|
|
@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
# [0.30.9] - 2025-08-10
|
||||
|
||||
## Added
|
||||
|
||||
- Internal data structure for separate devices in a single user account.
|
||||
- Geodata from Immich and Photoprism now will also write `tracker_id` to the points table. This will allow to group points by device. It's a good idea to delete your existing imports from Photoprism and Immich and import them again. This will remove existing points and re-import them as long as photos are still available.
|
||||
- [ ] Add tracker_id index to points table
|
||||
|
||||
|
||||
# [0.30.8] - 2025-08-01
|
||||
|
||||
## Fixed
|
||||
|
|
@ -12,14 +21,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||
- Possibly fixed a bug where visits were no suggested correctly. #984
|
||||
- Scratch map is now working correctly.
|
||||
|
||||
## Added
|
||||
|
||||
- Internal data structure for separate devices in a single user account.
|
||||
- [ ] Immich and Photoprism integrations should fill all possible fields in points table
|
||||
- Geodata from Immich and Photoprism now will also write `tracker_id` to the points table. This will allow to group points by device. It's a good idea to delete your existing imports from Photoprism and Immich and import them again. This will remove existing points and re-import them as long as photos are still available.
|
||||
- [ ] Add tracker_id index to points table
|
||||
|
||||
|
||||
|
||||
# [0.30.7] - 2025-08-01
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
class AddUniqueIndexToPointsWithDeviceId < ActiveRecord::Migration[8.0]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_index :points, [:lonlat, :timestamp, :user_id, :device_id],
|
||||
name: "index_points_on_lonlat_timestamp_user_id_device_id",
|
||||
unique: true,
|
||||
algorithm: :concurrently,
|
||||
if_not_exists: true
|
||||
end
|
||||
|
||||
def down
|
||||
remove_index :points, name: "index_points_on_lonlat_timestamp_user_id_device_id", algorithm: :concurrently
|
||||
end
|
||||
end
|
||||
14
db/migrate/20250810110943_add_index_to_points_tracker_id.rb
Normal file
14
db/migrate/20250810110943_add_index_to_points_tracker_id.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
class AddIndexToPointsTrackerId < ActiveRecord::Migration[8.0]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_index :points, :tracker_id,
|
||||
name: "index_points_on_tracker_id",
|
||||
algorithm: :concurrently,
|
||||
if_not_exists: true
|
||||
end
|
||||
|
||||
def down
|
||||
remove_index :points, name: "index_points_on_tracker_id", algorithm: :concurrently
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
class RemoveOldUniqueIndexFromPoints < ActiveRecord::Migration[8.0]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
remove_index :points, name: "index_points_on_lonlat_timestamp_user_id", algorithm: :concurrently
|
||||
end
|
||||
|
||||
def down
|
||||
add_index :points, [:lonlat, :timestamp, :user_id],
|
||||
name: "index_points_on_lonlat_timestamp_user_id",
|
||||
unique: true,
|
||||
algorithm: :concurrently,
|
||||
if_not_exists: true
|
||||
end
|
||||
end
|
||||
5
db/schema.rb
generated
5
db/schema.rb
generated
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.0].define(version: 2025_08_05_184855) do
|
||||
ActiveRecord::Schema[8.0].define(version: 2025_08_10_111002) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_catalog.plpgsql"
|
||||
enable_extension "postgis"
|
||||
|
|
@ -211,11 +211,12 @@ ActiveRecord::Schema[8.0].define(version: 2025_08_05_184855) do
|
|||
t.index ["geodata"], name: "index_points_on_geodata", using: :gin
|
||||
t.index ["import_id"], name: "index_points_on_import_id"
|
||||
t.index ["latitude", "longitude"], name: "index_points_on_latitude_and_longitude"
|
||||
t.index ["lonlat", "timestamp", "user_id"], name: "index_points_on_lonlat_timestamp_user_id", unique: true
|
||||
t.index ["lonlat", "timestamp", "user_id", "device_id"], name: "index_points_on_lonlat_timestamp_user_id_device_id", unique: true
|
||||
t.index ["lonlat"], name: "index_points_on_lonlat", using: :gist
|
||||
t.index ["reverse_geocoded_at"], name: "index_points_on_reverse_geocoded_at"
|
||||
t.index ["timestamp"], name: "index_points_on_timestamp"
|
||||
t.index ["track_id"], name: "index_points_on_track_id"
|
||||
t.index ["tracker_id"], name: "index_points_on_tracker_id"
|
||||
t.index ["trigger"], name: "index_points_on_trigger"
|
||||
t.index ["user_id", "timestamp", "track_id"], name: "idx_points_track_generation"
|
||||
t.index ["user_id"], name: "index_points_on_user_id"
|
||||
|
|
|
|||
Loading…
Reference in a new issue