Remove the ahoy_events table
We stopped using ahoy events in commit f7e2d724d.
This commit is contained in:
@@ -1,8 +0,0 @@
|
|||||||
module Ahoy
|
|
||||||
class Event < ApplicationRecord
|
|
||||||
self.table_name = "ahoy_events"
|
|
||||||
|
|
||||||
belongs_to :visit
|
|
||||||
belongs_to :user
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
class Visit < ApplicationRecord
|
class Visit < ApplicationRecord
|
||||||
alias_attribute :created_at, :started_at
|
alias_attribute :created_at, :started_at
|
||||||
has_many :ahoy_events, class_name: "Ahoy::Event"
|
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -13,12 +13,6 @@ class Ahoy::Store < Ahoy::DatabaseStore
|
|||||||
super(data)
|
super(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
def track_event(data)
|
|
||||||
data[:id] = ensure_uuid(data.delete(:event_id))
|
|
||||||
data[:ip] = request.ip
|
|
||||||
super(data)
|
|
||||||
end
|
|
||||||
|
|
||||||
def visit
|
def visit
|
||||||
unless defined?(@visit)
|
unless defined?(@visit)
|
||||||
if ahoy.send(:existing_visit_token) || ahoy.instance_variable_get(:@visit_token)
|
if ahoy.send(:existing_visit_token) || ahoy.instance_variable_get(:@visit_token)
|
||||||
|
|||||||
17
db/migrate/20240425224146_drop_ahoy_events.rb
Normal file
17
db/migrate/20240425224146_drop_ahoy_events.rb
Normal 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
|
||||||
13
db/schema.rb
13
db/schema.rb
@@ -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"
|
t.index ["user_id"], name: "index_administrators_on_user_id"
|
||||||
end
|
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|
|
create_table "audits", id: :serial, force: :cascade do |t|
|
||||||
t.integer "auditable_id"
|
t.integer "auditable_id"
|
||||||
t.string "auditable_type"
|
t.string "auditable_type"
|
||||||
|
|||||||
Reference in New Issue
Block a user