Remove the ahoy_events table

We stopped using ahoy events in commit f7e2d724d.
This commit is contained in:
Javi Martín
2024-04-26 00:46:59 +02:00
parent 10e66006c8
commit 6ab51b0367
5 changed files with 17 additions and 28 deletions

View File

@@ -1,8 +0,0 @@
module Ahoy
class Event < ApplicationRecord
self.table_name = "ahoy_events"
belongs_to :visit
belongs_to :user
end
end

View File

@@ -1,5 +1,4 @@
class Visit < ApplicationRecord
alias_attribute :created_at, :started_at
has_many :ahoy_events, class_name: "Ahoy::Event"
belongs_to :user
end

View File

@@ -13,12 +13,6 @@ class Ahoy::Store < Ahoy::DatabaseStore
super(data)
end
def track_event(data)
data[:id] = ensure_uuid(data.delete(:event_id))
data[:ip] = request.ip
super(data)
end
def visit
unless defined?(@visit)
if ahoy.send(:existing_visit_token) || ahoy.instance_variable_get(:@visit_token)

View File

@@ -0,0 +1,17 @@
class DropAhoyEvents < ActiveRecord::Migration[7.0]
def change
drop_table :ahoy_events, id: :uuid, default: nil do |t|
t.uuid :visit_id
t.integer :user_id
t.string :name
t.jsonb :properties
t.datetime :time, precision: nil
t.string :ip
t.index [:name, :time]
t.index [:time]
t.index [:user_id]
t.index [:visit_id]
end
end
end

View File

@@ -96,19 +96,6 @@ ActiveRecord::Schema[7.0].define(version: 2024_10_26_112901) do
t.index ["user_id"], name: "index_administrators_on_user_id"
end
create_table "ahoy_events", id: :uuid, default: nil, force: :cascade do |t|
t.uuid "visit_id"
t.integer "user_id"
t.string "name"
t.jsonb "properties"
t.datetime "time", precision: nil
t.string "ip"
t.index ["name", "time"], name: "index_ahoy_events_on_name_and_time"
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
create_table "audits", id: :serial, force: :cascade do |t|
t.integer "auditable_id"
t.string "auditable_type"