Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit b8a047c

Browse files
committed
Spring cleaning: remove user records where github_id is nil (related to #979)
For real github accounts, the github_id is not nil. So if the id is nil, it is a fake account or an input error. Updated seeds with github_id
1 parent 5766aff commit b8a047c

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class DestroyNonExistingGitHubUsers < ActiveRecord::Migration[5.1]
2+
def up
3+
execute 'DELETE FROM users WHERE github_id IS NULL'
4+
end
5+
end

db/schema.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema.define(version: 20180514195656) do
13+
ActiveRecord::Schema.define(version: 20180524190818) do
1414

1515
# These are extensions that must be enabled in order to support this database
1616
enable_extension "plpgsql"

spec/factories/users.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
FactoryBot.define do
22
factory :user, aliases: [:member] do
33
github_handle { FFaker::InternetSE.unique.user_name_variant_short }
4+
sequence(:github_id, 123)
45
name { FFaker::Name.name }
56
email { FFaker::Internet.email }
67
location { FFaker::Address.city }

0 commit comments

Comments
 (0)