Skip to content

Commit 347af8d

Browse files
committed
migration and tests
1 parent ab20d62 commit 347af8d

15 files changed

+157
-78
lines changed

config/initializers/elasticsearch.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Tire.configure do
2+
url ENV['ELASTICSEARCH_URL']
3+
end
4+
5+
Elasticsearch::Model.client = Elasticsearch::Client.new url: ENV['ELASTICSEARCH_URL']

config/initializers/tire.rb

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class AddMigrationFields < ActiveRecord::Migration
2+
def up
3+
add_column :teams, :mongo_id, :string, unique: true
4+
add_column :teams_members, :state, :string, unique: true , default: 'pending'
5+
add_column :users, :team_id, :integer, index: true
6+
end
7+
end
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
class FixPgTeam < ActiveRecord::Migration
2+
def up
3+
remove_column :teams, :office_photos
4+
add_column :teams, :office_photos, :string, array: true, default: []
5+
remove_column :teams, :upcoming_events
6+
add_column :teams, :upcoming_events, :text, array: true, default: []
7+
remove_column :teams, :interview_steps
8+
add_column :teams, :interview_steps, :text, array: true, default: []
9+
remove_column :teams, :invited_emails
10+
add_column :teams, :invited_emails, :string, array: true, default: []
11+
remove_column :teams, :pending_join_requests
12+
add_column :teams, :pending_join_requests, :string, array: true, default: []
13+
add_column :teams, :state, :string, default: 'active'
14+
change_column :teams_locations, :description, :text
15+
change_column :teams_locations, :address, :text
16+
change_column :teams_links, :url, :text
17+
add_column :followed_teams, :team_id, :integer, index: true
18+
remove_column :teams_members, :team_size
19+
remove_column :teams_members, :badges_count
20+
remove_column :teams_members, :email
21+
remove_column :teams_members, :inviter_id
22+
remove_column :teams_members, :name
23+
remove_column :teams_members, :thumbnail_url
24+
remove_column :teams_members, :username
25+
end
26+
end

db/schema.rb

Lines changed: 38 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
#
1212
# It's strongly recommended to check this file into your version control system.
1313

14-
ActiveRecord::Schema.define(:version => 20140807214719) do
14+
ActiveRecord::Schema.define(:version => 20140823174046) do
1515

1616
add_extension "citext"
17+
add_extension "hstore"
1718

1819
create_table "alias_tags", :id => false, :force => true do |t|
1920
t.integer "tag_id"
@@ -104,7 +105,8 @@
104105
create_table "followed_teams", :force => true do |t|
105106
t.integer "user_id"
106107
t.string "team_document_id"
107-
t.datetime "created_at", :default => '2014-02-20 22:39:11'
108+
t.datetime "created_at", :default => '2012-03-12 21:01:09'
109+
t.integer "team_id"
108110
end
109111

110112
add_index "followed_teams", ["team_document_id"], :name => "index_followed_teams_on_team_document_id"
@@ -353,8 +355,8 @@
353355
end
354356

355357
create_table "teams", :force => true do |t|
356-
t.datetime "created_at", :null => false
357-
t.datetime "updated_at", :null => false
358+
t.datetime "created_at", :null => false
359+
t.datetime "updated_at", :null => false
358360
t.string "website"
359361
t.text "about"
360362
t.integer "total", :default => 0
@@ -394,20 +396,15 @@
394396
t.text "organization_way"
395397
t.text "organization_way_name"
396398
t.text "organization_way_photo"
397-
t.string "office_photos", :default => [], :array => true
398-
t.string "upcoming_events", :default => [], :array => true
399399
t.string "featured_links_title"
400400
t.text "blog_feed"
401401
t.text "our_challenge"
402402
t.text "your_impact"
403-
t.string "interview_steps", :default => [], :array => true
404403
t.text "hiring_tagline"
405404
t.text "link_to_careers_page"
406405
t.string "avatar"
407406
t.integer "achievement_count", :default => 0
408407
t.integer "endorsement_count", :default => 0
409-
t.string "invited_emails", :default => [], :array => true
410-
t.string "pending_join_requests", :default => [], :array => true
411408
t.datetime "upgraded_at"
412409
t.integer "paid_job_posts", :default => 0
413410
t.boolean "monthly_subscription", :default => false
@@ -418,6 +415,13 @@
418415
t.string "name"
419416
t.string "github_organization_name"
420417
t.integer "team_size"
418+
t.string "mongo_id"
419+
t.string "office_photos", :default => [], :array => true
420+
t.text "upcoming_events", :default => [], :array => true
421+
t.text "interview_steps", :default => [], :array => true
422+
t.string "invited_emails", :default => [], :array => true
423+
t.string "pending_join_requests", :default => [], :array => true
424+
t.string "state", :default => "active"
421425
end
422426

423427
create_table "teams_account_plans", :id => false, :force => true do |t|
@@ -437,16 +441,16 @@
437441

438442
create_table "teams_links", :force => true do |t|
439443
t.string "name"
440-
t.string "url"
444+
t.text "url"
441445
t.integer "team_id", :null => false
442446
t.datetime "created_at", :null => false
443447
t.datetime "updated_at", :null => false
444448
end
445449

446450
create_table "teams_locations", :force => true do |t|
447451
t.string "name"
448-
t.string "description"
449-
t.string "address"
452+
t.text "description"
453+
t.text "address"
450454
t.string "city"
451455
t.string "state_code"
452456
t.string "country"
@@ -456,17 +460,11 @@
456460
end
457461

458462
create_table "teams_members", :force => true do |t|
459-
t.integer "team_id", :null => false
460-
t.integer "user_id", :null => false
461-
t.datetime "created_at", :null => false
462-
t.datetime "updated_at", :null => false
463-
t.integer "team_size", :default => 0
464-
t.integer "badges_count"
465-
t.string "email"
466-
t.integer "inviter_id"
467-
t.string "name"
468-
t.string "thumbnail_url"
469-
t.string "username"
463+
t.integer "team_id", :null => false
464+
t.integer "user_id", :null => false
465+
t.datetime "created_at", :null => false
466+
t.datetime "updated_at", :null => false
467+
t.string "state", :default => "pending"
470468
end
471469

472470
create_table "tokens", :force => true do |t|
@@ -484,7 +482,7 @@
484482
t.integer "user_id"
485483
t.string "name"
486484
t.text "data"
487-
t.datetime "created_at", :default => '2014-02-20 22:39:11'
485+
t.datetime "created_at", :default => '2012-03-12 21:01:10'
488486
end
489487

490488
create_table "users", :force => true do |t|
@@ -505,8 +503,8 @@
505503
t.string "bitbucket"
506504
t.string "codeplex"
507505
t.integer "login_count", :default => 0
508-
t.datetime "last_request_at", :default => '2014-07-17 13:10:04'
509-
t.datetime "achievements_checked_at", :default => '1914-02-20 22:39:10'
506+
t.datetime "last_request_at", :default => '2014-07-23 03:14:36'
507+
t.datetime "achievements_checked_at", :default => '1911-08-12 21:49:21'
510508
t.text "claim_code"
511509
t.integer "github_id"
512510
t.string "country"
@@ -516,7 +514,7 @@
516514
t.float "lng"
517515
t.integer "http_counter"
518516
t.string "github_token"
519-
t.datetime "twitter_checked_at", :default => '1914-02-20 22:39:10'
517+
t.datetime "twitter_checked_at", :default => '1911-08-12 21:49:21'
520518
t.string "title"
521519
t.string "company"
522520
t.string "blog"
@@ -553,6 +551,7 @@
553551
t.string "tracking_code"
554552
t.string "utm_campaign"
555553
t.float "score_cache", :default => 0.0
554+
t.string "gender"
556555
t.boolean "notify_on_follow", :default => true
557556
t.string "api_key"
558557
t.datetime "remind_to_create_team"
@@ -563,6 +562,12 @@
563562
t.text "team_responsibilities"
564563
t.string "team_avatar"
565564
t.string "team_banner"
565+
t.string "stat_name_1"
566+
t.string "stat_number_1"
567+
t.string "stat_name_2"
568+
t.string "stat_number_2"
569+
t.string "stat_name_3"
570+
t.string "stat_number_3"
566571
t.float "ip_lat"
567572
t.float "ip_lng"
568573
t.float "penalty", :default => 0.0
@@ -571,13 +576,17 @@
571576
t.string "resume"
572577
t.string "sourceforge"
573578
t.string "google_code"
579+
t.boolean "sales_rep", :default => false
574580
t.string "visits", :default => ""
575581
t.string "visit_frequency", :default => "rarely"
582+
t.integer "pitchbox_id"
576583
t.boolean "join_badge_orgs", :default => false
584+
t.boolean "use_social_for_pitchbox", :default => false
577585
t.datetime "last_asm_email_at"
578586
t.datetime "banned_at"
579587
t.string "last_ip"
580588
t.string "last_ua"
589+
t.integer "team_id"
581590
end
582591

583592
add_index "users", ["linkedin_id"], :name => "index_users_on_linkedin_id", :unique => true
@@ -637,9 +646,9 @@
637646
t.string "homepage"
638647
t.boolean "fork", :default => false
639648
t.integer "forks_count", :default => 0
640-
t.datetime "forks_count_updated_at", :default => '2014-07-18 23:03:00'
649+
t.datetime "forks_count_updated_at", :default => '2014-07-23 03:14:37'
641650
t.integer "stargazers_count", :default => 0
642-
t.datetime "stargazers_count_updated_at", :default => '2014-07-18 23:03:00'
651+
t.datetime "stargazers_count_updated_at", :default => '2014-07-23 03:14:37'
643652
t.string "language"
644653
t.integer "followers_count", :default => 0, :null => false
645654
t.integer "github_id", :null => false

spec/fabricators/pg_team_fabricator.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,15 @@
4747
# organization_way :text
4848
# organization_way_name :text
4949
# organization_way_photo :text
50-
# office_photos :string(255) default("{}")
51-
# upcoming_events :string(255) default("{}")
5250
# featured_links_title :string(255)
5351
# blog_feed :text
5452
# our_challenge :text
5553
# your_impact :text
56-
# interview_steps :string(255) default("{}")
5754
# hiring_tagline :text
5855
# link_to_careers_page :text
5956
# avatar :string(255)
6057
# achievement_count :integer default(0)
6158
# endorsement_count :integer default(0)
62-
# invited_emails :string(255) default("{}")
63-
# pending_join_requests :string(255) default("{}")
6459
# upgraded_at :datetime
6560
# paid_job_posts :integer default(0)
6661
# monthly_subscription :boolean default(FALSE)
@@ -71,4 +66,11 @@
7166
# name :string(255)
7267
# github_organization_name :string(255)
7368
# team_size :integer
69+
# mongo_id :string(255)
70+
# office_photos :string(255) default([]), is an Array
71+
# upcoming_events :text default([]), is an Array
72+
# interview_steps :text default([]), is an Array
73+
# invited_emails :string(255) default([]), is an Array
74+
# pending_join_requests :string(255) default([]), is an Array
75+
# state :string(255) default("active")
7476
#

spec/fabricators/user_fabricator.rb

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
# bitbucket :string(255)
4242
# codeplex :string(255)
4343
# login_count :integer default(0)
44-
# last_request_at :datetime default(2014-07-17 13:10:04 UTC)
45-
# achievements_checked_at :datetime default(1914-02-20 22:39:10 UTC)
44+
# last_request_at :datetime default(2014-07-23 03:14:36 UTC)
45+
# achievements_checked_at :datetime default(1911-08-12 21:49:21 UTC)
4646
# claim_code :text
4747
# github_id :integer
4848
# country :string(255)
@@ -52,11 +52,11 @@
5252
# lng :float
5353
# http_counter :integer
5454
# github_token :string(255)
55-
# twitter_checked_at :datetime default(1914-02-20 22:39:10 UTC)
55+
# twitter_checked_at :datetime default(1911-08-12 21:49:21 UTC)
5656
# title :string(255)
5757
# company :string(255)
5858
# blog :string(255)
59-
# github :string(255)
59+
# github :citext
6060
# forrst :string(255)
6161
# dribbble :string(255)
6262
# specialties :text
@@ -89,6 +89,7 @@
8989
# tracking_code :string(255)
9090
# utm_campaign :string(255)
9191
# score_cache :float default(0.0)
92+
# gender :string(255)
9293
# notify_on_follow :boolean default(TRUE)
9394
# api_key :string(255)
9495
# remind_to_create_team :datetime
@@ -99,6 +100,12 @@
99100
# team_responsibilities :text
100101
# team_avatar :string(255)
101102
# team_banner :string(255)
103+
# stat_name_1 :string(255)
104+
# stat_number_1 :string(255)
105+
# stat_name_2 :string(255)
106+
# stat_number_2 :string(255)
107+
# stat_name_3 :string(255)
108+
# stat_number_3 :string(255)
102109
# ip_lat :float
103110
# ip_lng :float
104111
# penalty :float default(0.0)
@@ -107,11 +114,15 @@
107114
# resume :string(255)
108115
# sourceforge :string(255)
109116
# google_code :string(255)
117+
# sales_rep :boolean default(FALSE)
110118
# visits :string(255) default("")
111119
# visit_frequency :string(255) default("rarely")
120+
# pitchbox_id :integer
112121
# join_badge_orgs :boolean default(FALSE)
122+
# use_social_for_pitchbox :boolean default(FALSE)
113123
# last_asm_email_at :datetime
114124
# banned_at :datetime
115125
# last_ip :string(255)
116126
# last_ua :string(255)
127+
# team_id :integer
117128
#

spec/models/followed_team_spec.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# == Schema Information
2+
#
3+
# Table name: followed_teams
4+
#
5+
# id :integer not null, primary key
6+
# user_id :integer
7+
# team_document_id :string(255)
8+
# created_at :datetime default(2012-03-12 21:01:09 UTC)
9+
# team_id :integer
10+
#
11+
12+
require 'rails_helper'
13+
14+
RSpec.describe FollowedTeam, :type => :model do
15+
it {is_expected.to belong_to(:team)}
16+
it {is_expected.to belong_to(:user)}
17+
end

0 commit comments

Comments
 (0)