Ruby迁移和种子问题[已关闭]

hm2xizp9  于 2023-05-06  发布在  Ruby
关注(0)|答案(1)|浏览(216)

已关闭,此问题需要details or clarity。目前不接受答复。
**想改善这个问题吗?**通过editing this post添加详细信息并澄清问题。

3天前关闭。
Improve this question

rails db:seed
rails aborted!
ActiveRecord::RecordNotUnique: SQLite3::ConstraintException: UNIQUE constraint failed: index 'index_users_on_confirmation_token'
C:/Users/belli/OneDrive/CAMBRIDGE/technical_test2/money_transfer/db/seeds.rb:12:in `block in <main>'
C:/Users/belli/OneDrive/CAMBRIDGE/technical_test2/money_transfer/db/seeds.rb:11:in `times'
C:/Users/belli/OneDrive/CAMBRIDGE/technical_test2/money_transfer/db/seeds.rb:11:in `<main>'

Caused by:
SQLite3::ConstraintException: UNIQUE constraint failed: index 'index_users_on_confirmation_token'
C:/Users/belli/OneDrive/CAMBRIDGE/technical_test2/money_transfer/db/seeds.rb:12:in `block in <main>'
C:/Users/belli/OneDrive/CAMBRIDGE/technical_test2/money_transfer/db/seeds.rb:11:in `times'
C:/Users/belli/OneDrive/CAMBRIDGE/technical_test2/money_transfer/db/seeds.rb:11:in `<main>'
Tasks: TOP => db:seed
(See full trace by running task with --trace)

尝试查看我的数据库并得到错误

wfauudbj

wfauudbj1#

这条线

UNIQUE constraint failed: index 'index_users_on_confirmation_token'

表示您的seeds.rb正在为多个用户生成相同的confirmation_token

相关问题