mirror of
https://github.com/SrIzan10/hc-harbor.git
synced 2026-05-01 10:45:21 +00:00
project lookup indexes
This commit is contained in:
15
db/migrate/20250709001202_add_stats_performance_indexes.rb
Normal file
15
db/migrate/20250709001202_add_stats_performance_indexes.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
class AddStatsPerformanceIndexes < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
add_index :heartbeats, [ :user_id, :time, :project ],
|
||||
name: "idx_heartbeats_user_time_project_stats",
|
||||
where: "deleted_at IS NULL"
|
||||
|
||||
add_index :heartbeats, [ :user_id, :time, :language ],
|
||||
name: "idx_heartbeats_user_time_language_stats",
|
||||
where: "deleted_at IS NULL"
|
||||
|
||||
add_index :heartbeats, [ :user_id, :project, :time ],
|
||||
name: "idx_heartbeats_user_project_time_stats",
|
||||
where: "deleted_at IS NULL AND project IS NOT NULL"
|
||||
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_07_01_142553) do
|
||||
ActiveRecord::Schema[8.0].define(version: 2025_07_09_001202) do
|
||||
create_schema "pganalyze"
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
@@ -260,7 +260,10 @@ ActiveRecord::Schema[8.0].define(version: 2025_07_01_142553) do
|
||||
t.index ["fields_hash"], name: "index_heartbeats_on_fields_hash_when_not_deleted", unique: true, where: "(deleted_at IS NULL)"
|
||||
t.index ["raw_heartbeat_upload_id"], name: "index_heartbeats_on_raw_heartbeat_upload_id"
|
||||
t.index ["source_type", "time", "user_id", "project"], name: "index_heartbeats_on_source_type_time_user_project"
|
||||
t.index ["user_id", "project", "time"], name: "idx_heartbeats_user_project_time_stats", where: "((deleted_at IS NULL) AND (project IS NOT NULL))"
|
||||
t.index ["user_id", "time", "category"], name: "index_heartbeats_on_user_time_category"
|
||||
t.index ["user_id", "time", "language"], name: "idx_heartbeats_user_time_language_stats", where: "(deleted_at IS NULL)"
|
||||
t.index ["user_id", "time", "project"], name: "idx_heartbeats_user_time_project_stats", 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