merges master and fixes conflicts
This commit is contained in:
56
db/migrate/20150804144230_create_visits.rb
Normal file
56
db/migrate/20150804144230_create_visits.rb
Normal file
@@ -0,0 +1,56 @@
|
||||
class CreateVisits < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :visits, id: false do |t|
|
||||
t.uuid :id, default: nil, primary_key: true
|
||||
t.uuid :visitor_id, default: nil
|
||||
|
||||
# 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
|
||||
t.integer :screen_height
|
||||
t.integer :screen_width
|
||||
|
||||
# location
|
||||
t.string :country
|
||||
t.string :region
|
||||
t.string :city
|
||||
t.string :postal_code
|
||||
t.decimal :latitude
|
||||
t.decimal :longitude
|
||||
|
||||
# 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
|
||||
20
db/migrate/20150804144231_create_ahoy_events.rb
Normal file
20
db/migrate/20150804144231_create_ahoy_events.rb
Normal file
@@ -0,0 +1,20 @@
|
||||
class CreateAhoyEvents < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :ahoy_events, id: false do |t|
|
||||
t.uuid :id, default: nil, primary_key: true
|
||||
t.uuid :visit_id, default: nil
|
||||
|
||||
# user
|
||||
t.integer :user_id
|
||||
# add t.string :user_type if polymorphic
|
||||
|
||||
t.string :name
|
||||
t.jsonb :properties
|
||||
t.timestamp :time
|
||||
end
|
||||
|
||||
add_index :ahoy_events, [:visit_id]
|
||||
add_index :ahoy_events, [:user_id]
|
||||
add_index :ahoy_events, [:time]
|
||||
end
|
||||
end
|
||||
5
db/migrate/20150808100936_add_ip_to_ahoy_event.rb
Normal file
5
db/migrate/20150808100936_add_ip_to_ahoy_event.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class AddIpToAhoyEvent < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :ahoy_events, :ip, :string
|
||||
end
|
||||
end
|
||||
5
db/migrate/20150808102442_add_visit_id_to_debate.rb
Normal file
5
db/migrate/20150808102442_add_visit_id_to_debate.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class AddVisitIdToDebate < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :debates, :visit_id, :string
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
class AddOfficialPositionToUser < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :users, :official_position, :string
|
||||
add_column :users, :official_level, :integer, default: 0
|
||||
end
|
||||
end
|
||||
8
db/migrate/20150817150457_add_settings.rb
Normal file
8
db/migrate/20150817150457_add_settings.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
class AddSettings < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :settings do |t|
|
||||
t.string :key
|
||||
t.string :value
|
||||
end
|
||||
end
|
||||
end
|
||||
60
db/schema.rb
60
db/schema.rb
@@ -11,7 +11,8 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20150815154430) do
|
||||
ActiveRecord::Schema.define(version: 20150817150457) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
@@ -21,6 +22,19 @@ ActiveRecord::Schema.define(version: 20150815154430) do
|
||||
|
||||
add_index "administrators", ["user_id"], name: "index_administrators_on_user_id", using: :btree
|
||||
|
||||
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"
|
||||
t.string "ip"
|
||||
end
|
||||
|
||||
add_index "ahoy_events", ["time"], name: "index_ahoy_events_on_time", using: :btree
|
||||
add_index "ahoy_events", ["user_id"], name: "index_ahoy_events_on_user_id", using: :btree
|
||||
add_index "ahoy_events", ["visit_id"], name: "index_ahoy_events_on_visit_id", using: :btree
|
||||
|
||||
create_table "comments", force: :cascade do |t|
|
||||
t.integer "commentable_id"
|
||||
t.string "commentable_type"
|
||||
@@ -48,6 +62,7 @@ ActiveRecord::Schema.define(version: 20150815154430) do
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "hidden_at"
|
||||
t.string "visit_id"
|
||||
end
|
||||
|
||||
add_index "debates", ["hidden_at"], name: "index_debates_on_hidden_at", using: :btree
|
||||
@@ -67,6 +82,11 @@ ActiveRecord::Schema.define(version: 20150815154430) do
|
||||
|
||||
add_index "organizations", ["user_id"], name: "index_organizations_on_user_id", using: :btree
|
||||
|
||||
create_table "settings", force: :cascade do |t|
|
||||
t.string "key"
|
||||
t.string "value"
|
||||
end
|
||||
|
||||
create_table "simple_captcha_data", force: :cascade do |t|
|
||||
t.string "key", limit: 40
|
||||
t.string "value", limit: 6
|
||||
@@ -117,16 +137,48 @@ ActiveRecord::Schema.define(version: 20150815154430) do
|
||||
t.datetime "confirmation_sent_at"
|
||||
t.string "unconfirmed_email"
|
||||
t.string "nickname"
|
||||
t.boolean "use_nickname", default: false, null: false
|
||||
t.boolean "email_on_debate_comment", default: false
|
||||
t.boolean "email_on_comment_reply", default: false
|
||||
t.string "phone_number", limit: 30
|
||||
t.boolean "use_nickname", default: false, null: false
|
||||
t.boolean "email_on_debate_comment", default: false
|
||||
t.boolean "email_on_comment_reply", default: false
|
||||
t.string "official_position"
|
||||
t.integer "official_level", default: 0
|
||||
end
|
||||
|
||||
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
|
||||
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
|
||||
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
|
||||
|
||||
create_table "visits", id: :uuid, default: nil, force: :cascade do |t|
|
||||
t.uuid "visitor_id"
|
||||
t.string "ip"
|
||||
t.text "user_agent"
|
||||
t.text "referrer"
|
||||
t.text "landing_page"
|
||||
t.integer "user_id"
|
||||
t.string "referring_domain"
|
||||
t.string "search_keyword"
|
||||
t.string "browser"
|
||||
t.string "os"
|
||||
t.string "device_type"
|
||||
t.integer "screen_height"
|
||||
t.integer "screen_width"
|
||||
t.string "country"
|
||||
t.string "region"
|
||||
t.string "city"
|
||||
t.string "postal_code"
|
||||
t.decimal "latitude"
|
||||
t.decimal "longitude"
|
||||
t.string "utm_source"
|
||||
t.string "utm_medium"
|
||||
t.string "utm_term"
|
||||
t.string "utm_content"
|
||||
t.string "utm_campaign"
|
||||
t.datetime "started_at"
|
||||
end
|
||||
|
||||
add_index "visits", ["user_id"], name: "index_visits_on_user_id", using: :btree
|
||||
|
||||
create_table "votes", force: :cascade do |t|
|
||||
t.integer "votable_id"
|
||||
t.string "votable_type"
|
||||
|
||||
15
db/seeds.rb
15
db/seeds.rb
@@ -1,7 +1,8 @@
|
||||
# This file should contain all the record creation needed to seed the database with its default values.
|
||||
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
||||
# Mayor.create(name: 'Emanuel', city: cities.first)
|
||||
# Names for the moderation console, as a hint for moderators
|
||||
# to know better how to assign users with official positions
|
||||
Setting.create(key: 'official_level_0_name', value: 'No cargo público')
|
||||
Setting.create(key: 'official_level_1_name', value: 'Organización Municipal')
|
||||
Setting.create(key: 'official_level_2_name', value: 'Funcionariado')
|
||||
Setting.create(key: 'official_level_3_name', value: 'Directores generales')
|
||||
Setting.create(key: 'official_level_4_name', value: 'Concejales')
|
||||
Setting.create(key: 'official_level_5_name', value: 'Alcaldes')
|
||||
Reference in New Issue
Block a user