After importing data in PostgreSQL, duplicate key value violates unique constraint

后端 未结 4 947
忘了有多久
忘了有多久 2021-02-02 17:51

I recently migrated my rails app to PostgreSQL in order to take advantage of fulltext search.

Since the migration coincided with moving to a new webhost, the steps for m

4条回答
  •  盖世英雄少女心
    2021-02-02 18:04

    In Rails you can use the command

    ActiveRecord::Base.connection.reset_pk_sequence!('users')

    to bring the primary key index for the User table in sync again.

提交回复
热议问题