4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/generators/ruby_cms/templates/db/migrate/20260211000001_add_ruby_cms_analytics_fields_to_ahoy_events.rb', line 4
def change
return unless table_exists?(:ahoy_events)
add_column :ahoy_events, :page_name, :string unless column_exists?(:ahoy_events, :page_name)
add_column :ahoy_events, :request_path, :string unless column_exists?(:ahoy_events, :request_path)
add_column :ahoy_events, :ip_address, :string unless column_exists?(:ahoy_events, :ip_address)
add_column :ahoy_events, :user_agent, :text unless column_exists?(:ahoy_events, :user_agent)
add_column :ahoy_events, :description, :text unless column_exists?(:ahoy_events, :description)
add_index :ahoy_events, :page_name, if_not_exists: true
add_index :ahoy_events, :request_path, if_not_exists: true
add_index :ahoy_events, :ip_address, if_not_exists: true
add_index :ahoy_events, %i[name page_name], if_not_exists: true
add_index :ahoy_events, %i[name request_path], if_not_exists: true
end
|