Skip to content

Commit

Permalink
Merge pull request #240 from Retrospring/add-indexes-to-notifications
Browse files Browse the repository at this point in the history
Add indexes to notifications table
  • Loading branch information
raccube authored Dec 28, 2021
2 parents fe6a04c + b438c89 commit 52ece6f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
6 changes: 6 additions & 0 deletions db/migrate/20211228135426_add_indexes_to_notifications.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AddIndexesToNotifications < ActiveRecord::Migration[5.2]
def change
add_index :notifications, :recipient_id
add_index :notifications, :new
end
end
9 changes: 3 additions & 6 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2021_12_19_153054) do
ActiveRecord::Schema.define(version: 2021_12_28_135426) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -114,6 +114,8 @@
t.boolean "new"
t.datetime "created_at"
t.datetime "updated_at"
t.index ["new"], name: "index_notifications_on_new"
t.index ["recipient_id"], name: "index_notifications_on_recipient_id"
end

create_table "profiles", force: :cascade do |t|
Expand Down Expand Up @@ -257,12 +259,7 @@
t.integer "asked_count", default: 0, null: false
t.integer "answered_count", default: 0, null: false
t.integer "commented_count", default: 0, null: false
t.string "display_name"
t.integer "smiled_count", default: 0, null: false
t.string "motivation_header", default: "", null: false
t.string "website", default: "", null: false
t.string "location", default: "", null: false
t.text "bio", default: "", null: false
t.string "profile_picture_file_name"
t.boolean "profile_picture_processing"
t.integer "profile_picture_x"
Expand Down
5 changes: 3 additions & 2 deletions spec/helpers/application_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@
describe "#answer_opengraph" do
context "sample user and answer" do
let!(:user) { FactoryBot.create(:user,
display_name: '',
bio: 'A bunch of raccoons in a trenchcoat.',
profile: {
display_name: '',
description: 'A bunch of raccoons in a trenchcoat.'},
screen_name: 'raccoons') }
let(:answer) { FactoryBot.create(:answer,
user_id: user.id,) }
Expand Down
3 changes: 2 additions & 1 deletion spec/models/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
password: 'y_u_no_secure_password?',
email: '[email protected]'
)
Profile.new(user: @user)
end

subject { @user }
Expand All @@ -23,7 +24,7 @@
end

it '#motivation_header has a default value' do
expect(@user.motivation_header).to match ''
expect(@user.profile.motivation_header).to match ''
end

it 'does not save an invalid screen name' do
Expand Down

0 comments on commit 52ece6f

Please sign in to comment.