mirror of
https://github.com/SrIzan10/hc-harbor.git
synced 2026-05-01 10:45:21 +00:00
Add user+time index to heartbeats
This commit is contained in:
7
db/migrate/20250507211848_add_index_to_heartbeats.rb
Normal file
7
db/migrate/20250507211848_add_index_to_heartbeats.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
class AddIndexToHeartbeats < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
add_index :heartbeats, [ :user_id, :time ],
|
||||
name: "idx_heartbeats_user_time_active",
|
||||
where: "deleted_at IS NULL"
|
||||
end
|
||||
end
|
||||
3
db/schema.rb
generated
3
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_05_07_204732) do
|
||||
ActiveRecord::Schema[8.0].define(version: 2025_05_07_211848) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_catalog.plpgsql"
|
||||
|
||||
@@ -210,6 +210,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_05_07_204732) do
|
||||
t.datetime "deleted_at"
|
||||
t.index ["category", "time"], name: "index_heartbeats_on_category_and_time"
|
||||
t.index ["fields_hash"], name: "index_heartbeats_on_fields_hash_when_not_deleted", unique: true, where: "(deleted_at IS NULL)"
|
||||
t.index ["user_id", "time"], name: "idx_heartbeats_user_time_active", where: "(deleted_at IS NULL)"
|
||||
t.index ["user_id"], name: "index_heartbeats_on_user_id"
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user