Sha256: 955696b65b19764b08bc719ce7fd6cef86a293dfb67297b05b7534a95a9298d6

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

class <%= migration_class_name %> < ActiveRecord::Migration
  def change
    create_table :visits, id: false do |t|
      t.uuid :id, primary_key: true
      t.uuid :visitor_id

      # the rest are recommended but optional
      # simply remove the columns you don't want

      # standard
      t.string :ip
      t.text :user_agent
      t.text :referrer
      t.text :landing_page

      # user
      t.integer :user_id
      # add t.string :user_type if polymorphic

      # traffic source
      t.string :referring_domain
      t.string :search_keyword

      # technology
      t.string :browser
      t.string :os
      t.string :device_type

      # location
      t.string :country
      t.string :region
      t.string :city

      # utm parameters
      t.string :utm_source
      t.string :utm_medium
      t.string :utm_term
      t.string :utm_content
      t.string :utm_campaign

      # native apps
      # t.string :platform
      # t.string :app_version
      # t.string :os_version

      t.timestamp :started_at
    end

    add_index :visits, [:user_id]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ahoy_matey-1.1.0 lib/generators/ahoy/stores/templates/active_record_visits_migration.rb
ahoy_matey-1.0.2 lib/generators/ahoy/stores/templates/active_record_visits_migration.rb
ahoy_matey-1.0.1 lib/generators/ahoy/stores/templates/active_record_visits_migration.rb
ahoy_matey-1.0.0 lib/generators/ahoy/stores/templates/active_record_visits_migration.rb