おせわになります。
ダミーデータを作成しようとしたところ、以下のエラーになります。
作成したいのは本番環境でEC2です。
いろいろ試したのですが、エラー解消されません。
あまり良くない事ですが、時間があまりないのでdbを再作成しようと考えています。
rails
1vagrant@vagrant-ubuntu-trusty:~/workspace/face_sns$ rake db:seed 2rake aborted! 3ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_users_on_uid_and_provider" 4DETAIL: Key (uid, provider)=(0, 0) already exists. 5: INSERT INTO "users" ("email", "encrypted_password", "uid", "provider", "created_at", "updated_at", "confirmation_token", "confirmation_sent_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" 6/home/vagrant/workspace/face_sns/db/seeds.rb:4:in `block in <top (required)>' 7/home/vagrant/workspace/face_sns/db/seeds.rb:1:in `times' 8/home/vagrant/workspace/face_sns/db/seeds.rb:1:in `<top (required)>' 9PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_users_on_uid_and_provider" 10DETAIL: Key (uid, provider)=(0, 0) already exists. 11/home/vagrant/workspace/face_sns/db/seeds.rb:4:in `block in <top (required)>' 12/home/vagrant/workspace/face_sns/db/seeds.rb:1:in `times' 13/home/vagrant/workspace/face_sns/db/seeds.rb:1:in `<top (required)>' 14Tasks: TOP => db:seed 15(See full trace by running task with --trace) 16
まだrailsについて勉強中でどのファイルを提示していいのか分かりませんので関係有りそうなファイルを載せてみます。
config/db.ymlファイル
1default: &default 2 adapter: postgresql 3 encoding: unicode 4 # For details on connection pooling, see rails configuration guide 5 # http://guides.rubyonrails.org/configuring.html#database-pooling 6 pool: 5 7 template: template0 8 9 10development: 11 <<: *default 12 database: face_development 13 14 <<: *default 15 database: face_test 16 17production: 18 <<: *default 19 database: face01_production 20 username: jyunia 21 password: <%= ENV['FACE_DATABASE_PASSWORD'] %> 22 23```seeds.rbファイル 24100.times do |n| 25 email = Faker::Internet.email 26 password = "password" 27 User.create!(email: email, 28 password: password, 29 password_confirmation: password, 30 uid: n, 31 provider: n, 32 ) 33end 34 35100.times do |t| 36 title = Faker::Book.title 37 content = Faker::Beer.name 38 Topic.create!(title: title, 39 content: content, 40 ) 41 42end 43 44100.times do |p| 45 content = Faker::Bank.name 46 Comment.create!(content: content, 47 ) 48end
宜しくお願い致します。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/06/26 21:18
2017/06/27 07:41