- Integrate Ahoy gem for tracking user events and visits - Create models for Ahoy events and visits - Implement admin interfaces for managing events and visits - Add background job for cleaning up old analytics data - Update application controller and other relevant controllers to track specific actions This commit implements a comprehensive event tracking system that logs user interactions within the application. Additionally, it includes mechanisms for managing and cleaning historical visit and event data, ensuring efficient data handling.
186 lines
7.0 KiB
Ruby
Generated
186 lines
7.0 KiB
Ruby
Generated
# This file is auto-generated from the current state of the database. Instead
|
|
# of editing this file, please use the migrations feature of Active Record to
|
|
# incrementally modify your database, and then regenerate this schema definition.
|
|
#
|
|
# This file is the source Rails uses to define your schema when running `bin/rails
|
|
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
|
# be faster and is potentially less error prone than running all of your
|
|
# migrations from scratch. Old migrations may fail to apply correctly if those
|
|
# migrations use external dependencies or application code.
|
|
#
|
|
# It's strongly recommended that you check this file into your version control system.
|
|
|
|
ActiveRecord::Schema[8.0].define(version: 2025_01_26_155239) do
|
|
create_table "active_admin_comments", force: :cascade do |t|
|
|
t.string "namespace"
|
|
t.text "body"
|
|
t.string "resource_type"
|
|
t.integer "resource_id"
|
|
t.string "author_type"
|
|
t.integer "author_id"
|
|
t.datetime "created_at", null: false
|
|
t.datetime "updated_at", null: false
|
|
t.index ["author_type", "author_id"], name: "index_active_admin_comments_on_author"
|
|
t.index ["namespace"], name: "index_active_admin_comments_on_namespace"
|
|
t.index ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource"
|
|
end
|
|
|
|
create_table "active_storage_attachments", force: :cascade do |t|
|
|
t.string "name", null: false
|
|
t.string "record_type", null: false
|
|
t.bigint "record_id", null: false
|
|
t.bigint "blob_id", null: false
|
|
t.datetime "created_at", null: false
|
|
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
|
|
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
|
|
end
|
|
|
|
create_table "active_storage_blobs", force: :cascade do |t|
|
|
t.string "key", null: false
|
|
t.string "filename", null: false
|
|
t.string "content_type"
|
|
t.text "metadata"
|
|
t.string "service_name", null: false
|
|
t.bigint "byte_size", null: false
|
|
t.string "checksum"
|
|
t.datetime "created_at", null: false
|
|
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
|
|
end
|
|
|
|
create_table "active_storage_variant_records", force: :cascade do |t|
|
|
t.bigint "blob_id", null: false
|
|
t.string "variation_digest", null: false
|
|
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
|
|
end
|
|
|
|
create_table "admin_users", force: :cascade do |t|
|
|
t.string "email", default: "", null: false
|
|
t.string "encrypted_password", default: "", null: false
|
|
t.string "reset_password_token"
|
|
t.datetime "reset_password_sent_at"
|
|
t.datetime "remember_created_at"
|
|
t.datetime "created_at", null: false
|
|
t.datetime "updated_at", null: false
|
|
t.index ["email"], name: "index_admin_users_on_email", unique: true
|
|
t.index ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true
|
|
end
|
|
|
|
create_table "ahoy_events", force: :cascade do |t|
|
|
t.integer "visit_id"
|
|
t.integer "user_id"
|
|
t.string "name"
|
|
t.text "properties"
|
|
t.datetime "time"
|
|
t.index ["name", "time"], name: "index_ahoy_events_on_name_and_time"
|
|
t.index ["user_id"], name: "index_ahoy_events_on_user_id"
|
|
t.index ["visit_id"], name: "index_ahoy_events_on_visit_id"
|
|
end
|
|
|
|
create_table "ahoy_visits", force: :cascade do |t|
|
|
t.string "visit_token"
|
|
t.string "visitor_token"
|
|
t.integer "user_id"
|
|
t.string "ip"
|
|
t.text "user_agent"
|
|
t.text "referrer"
|
|
t.string "referring_domain"
|
|
t.text "landing_page"
|
|
t.string "browser"
|
|
t.string "os"
|
|
t.string "device_type"
|
|
t.string "country"
|
|
t.string "region"
|
|
t.string "city"
|
|
t.float "latitude"
|
|
t.float "longitude"
|
|
t.string "utm_source"
|
|
t.string "utm_medium"
|
|
t.string "utm_term"
|
|
t.string "utm_content"
|
|
t.string "utm_campaign"
|
|
t.string "app_version"
|
|
t.string "os_version"
|
|
t.string "platform"
|
|
t.datetime "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"
|
|
end
|
|
|
|
create_table "cities", force: :cascade do |t|
|
|
t.string "name"
|
|
t.float "latitude"
|
|
t.float "longitude"
|
|
t.boolean "active"
|
|
t.integer "priority"
|
|
t.string "timezone"
|
|
t.datetime "created_at", null: false
|
|
t.datetime "updated_at", null: false
|
|
t.string "slug"
|
|
t.integer "country_id", null: false
|
|
t.index ["country_id"], name: "index_cities_on_country_id"
|
|
t.index ["slug"], name: "index_cities_on_slug", unique: true
|
|
end
|
|
|
|
create_table "countries", force: :cascade do |t|
|
|
t.string "name"
|
|
t.string "code"
|
|
t.string "slug"
|
|
t.integer "region_id", null: false
|
|
t.datetime "created_at", null: false
|
|
t.datetime "updated_at", null: false
|
|
t.index ["code"], name: "index_countries_on_code", unique: true
|
|
t.index ["region_id"], name: "index_countries_on_region_id"
|
|
t.index ["slug"], name: "index_countries_on_slug", unique: true
|
|
end
|
|
|
|
create_table "friendly_id_slugs", force: :cascade do |t|
|
|
t.string "slug", null: false
|
|
t.integer "sluggable_id", null: false
|
|
t.string "sluggable_type", limit: 50
|
|
t.string "scope"
|
|
t.datetime "created_at"
|
|
t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true
|
|
t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type"
|
|
t.index ["sluggable_type", "sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_type_and_sluggable_id"
|
|
end
|
|
|
|
create_table "regions", force: :cascade do |t|
|
|
t.string "name"
|
|
t.string "code"
|
|
t.string "slug"
|
|
t.datetime "created_at", null: false
|
|
t.datetime "updated_at", null: false
|
|
t.index ["code"], name: "index_regions_on_code", unique: true
|
|
t.index ["slug"], name: "index_regions_on_slug", unique: true
|
|
end
|
|
|
|
create_table "weather_arts", force: :cascade do |t|
|
|
t.integer "city_id", null: false
|
|
t.date "weather_date"
|
|
t.string "description"
|
|
t.decimal "temperature"
|
|
t.decimal "feeling_temp"
|
|
t.decimal "humidity"
|
|
t.string "wind_scale"
|
|
t.decimal "wind_speed"
|
|
t.decimal "precipitation"
|
|
t.decimal "pressure"
|
|
t.decimal "visibility"
|
|
t.decimal "cloud"
|
|
t.text "prompt"
|
|
t.datetime "created_at", null: false
|
|
t.datetime "updated_at", null: false
|
|
t.string "slug"
|
|
t.index ["city_id", "weather_date"], name: "index_weather_arts_on_city_id_and_weather_date"
|
|
t.index ["city_id"], name: "index_weather_arts_on_city_id"
|
|
t.index ["slug"], name: "index_weather_arts_on_slug", unique: true
|
|
end
|
|
|
|
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
|
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
|
add_foreign_key "cities", "countries"
|
|
add_foreign_key "countries", "regions"
|
|
add_foreign_key "weather_arts", "cities"
|
|
end
|