ERROR: null value in column "id" violates not-null constraint
This is easier:
ActiveRecord::Base.connection.tables.each do |t|
ActiveRecord::Base.connection.reset_pk_sequence!(t)
end
If sequence missing then create new sequence to all database table:
ActiveRecord::Base.connection.tables.each do |t|
ActiveRecord::Base.connection.execute("CREATE SEQUENCE #{t}_id_seq")
end
Your blog is in a convincing manner, thanks for sharing such an information with lots of your effort and time
ReplyDeleteruby on rails training India
ruby on rails training Hyderabad