Implements targets and campaigns for conference

This commit is contained in:
Chrisbr 2014-06-26 09:08:26 +02:00
parent 678fe38a25
commit 857ac43e74
40 changed files with 1086 additions and 44 deletions

View file

@ -0,0 +1,12 @@
class CreateTargets < ActiveRecord::Migration
def change
create_table :targets do |t|
t.integer :conference_id
t.integer :campaign_id
t.date :due_date
t.integer :target_count
t.string :unit
t.timestamps
end
end
end

View file

@ -0,0 +1,14 @@
class CreateCampaigns < ActiveRecord::Migration
def change
create_table :campaigns do |t|
t.integer :conference_id
t.string :name
t.string :utm_source
t.string :utm_medium
t.string :utm_term
t.string :utm_content
t.string :utm_campaign
t.timestamps
end
end
end

View file

@ -0,0 +1,51 @@
class CreateVisits < 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

View file

@ -0,0 +1,20 @@
class CreateAhoyEvents < ActiveRecord::Migration
def change
create_table :ahoy_events, id: false do |t|
t.uuid :id, primary_key: true
t.uuid :visit_id
# user
t.integer :user_id
# add t.string :user_type if polymorphic
t.string :name
t.text :properties
t.timestamp :time
end
add_index :ahoy_events, [:visit_id]
add_index :ahoy_events, [:user_id]
add_index :ahoy_events, [:time]
end
end