diff --git a/db/migrate/20180524190818_destroy_non_existing_git_hub_users.rb b/db/migrate/20180524190818_destroy_non_existing_git_hub_users.rb new file mode 100644 index 000000000..8d818983c --- /dev/null +++ b/db/migrate/20180524190818_destroy_non_existing_git_hub_users.rb @@ -0,0 +1,5 @@ +class DestroyNonExistingGitHubUsers < ActiveRecord::Migration[5.1] + def up + execute 'DELETE FROM users WHERE github_id IS NULL' + end +end diff --git a/db/schema.rb b/db/schema.rb index 7db9395fe..70444053e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180514195656) do +ActiveRecord::Schema.define(version: 20180524190818) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" diff --git a/spec/factories/users.rb b/spec/factories/users.rb index acd0a8abc..edc00ed9d 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,6 +1,7 @@ FactoryBot.define do factory :user, aliases: [:member] do github_handle { FFaker::InternetSE.unique.user_name_variant_short } + sequence(:github_id, 123) name { FFaker::Name.name } email { FFaker::Internet.email } location { FFaker::Address.city }