Add AhoyCaptain indexes

This commit is contained in:
Max Wofford
2025-06-09 16:39:51 -04:00
parent 68edb372ad
commit cfecba5ab9
2 changed files with 10 additions and 1 deletions

View File

@@ -0,0 +1,7 @@
class CreateAhoyCaptainIndexes < ActiveRecord::Migration[8.0]
def change
add_index :ahoy_visits, :started_at unless index_exists?(:ahoy_visits, :started_at)
add_index :ahoy_events, :visit_id unless index_exists?(:ahoy_events, :visit_id)
add_index :ahoy_events, :time unless index_exists?(:ahoy_events, :time)
end
end

4
db/schema.rb generated
View File

@@ -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_06_09_144356) do
ActiveRecord::Schema[8.0].define(version: 2025_06_09_203830) do
create_schema "pganalyze"
# These are extensions that must be enabled in order to support this database
@@ -25,6 +25,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_09_144356) do
t.datetime "time"
t.index ["name", "time"], name: "index_ahoy_events_on_name_and_time"
t.index ["properties"], name: "index_ahoy_events_on_properties", opclass: :jsonb_path_ops, using: :gin
t.index ["time"], name: "index_ahoy_events_on_time"
t.index ["user_id"], name: "index_ahoy_events_on_user_id"
t.index ["visit_id"], name: "index_ahoy_events_on_visit_id"
end
@@ -55,6 +56,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_09_144356) do
t.string "os_version"
t.string "platform"
t.datetime "started_at"
t.index ["started_at"], name: "index_ahoy_visits_on_started_at"
t.index ["user_id"], name: "index_ahoy_visits_on_user_id"
t.index ["visit_token"], name: "index_ahoy_visits_on_visit_token", unique: true
t.index ["visitor_token", "started_at"], name: "index_ahoy_visits_on_visitor_token_and_started_at"