Add DeviceDetector and postres_cursor

This commit is contained in:
Dan Milne
2025-11-13 08:35:00 +11:00
parent cc8213f87a
commit 2c7b801ed5
15 changed files with 472 additions and 158 deletions

View File

@@ -0,0 +1,5 @@
class RenameActionToPolicyActionOnWafPolicies < ActiveRecord::Migration[8.1]
def change
rename_column :waf_policies, :action, :policy_action
end
end

View File

@@ -0,0 +1,23 @@
class AddNetworkIntelligenceToEvents < ActiveRecord::Migration[8.1]
def change
# Add network intelligence columns for denormalization
add_column :events, :country, :string
add_column :events, :company, :string
add_column :events, :asn, :integer
add_column :events, :asn_org, :string
add_column :events, :is_datacenter, :boolean, default: false, null: false
add_column :events, :is_vpn, :boolean, default: false, null: false
add_column :events, :is_proxy, :boolean, default: false, null: false
add_column :events, :network_range_id, :bigint
# Add indexes for commonly queried fields
add_index :events, :country
add_index :events, :company
add_index :events, :asn
add_index :events, :network_range_id
add_index :events, [:is_datacenter, :is_vpn, :is_proxy], name: 'index_events_on_network_flags'
# Backfill skipped - run manually after migration
# See script/backfill_network_intelligence.rb or lib/tasks/events.rake
end
end