diff --git a/CHANGELOG.md b/CHANGELOG.md index a970503f..e505d48b 100644 --- a/CHANGELOG.md +++ b/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 diff --git a/db/migrate/20250810110904_add_unique_index_to_points_with_device_id.rb b/db/migrate/20250810110904_add_unique_index_to_points_with_device_id.rb new file mode 100644 index 00000000..833c171c --- /dev/null +++ b/db/migrate/20250810110904_add_unique_index_to_points_with_device_id.rb @@ -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 diff --git a/db/migrate/20250810110943_add_index_to_points_tracker_id.rb b/db/migrate/20250810110943_add_index_to_points_tracker_id.rb new file mode 100644 index 00000000..f7d8307c --- /dev/null +++ b/db/migrate/20250810110943_add_index_to_points_tracker_id.rb @@ -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 diff --git a/db/migrate/20250810111002_remove_old_unique_index_from_points.rb b/db/migrate/20250810111002_remove_old_unique_index_from_points.rb new file mode 100644 index 00000000..3233ab31 --- /dev/null +++ b/db/migrate/20250810111002_remove_old_unique_index_from_points.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 2021122b..f7bb9d85 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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"