lundi 23 novembre 2015

How to autoarrange id: number in Sqlite database using rails console

I have generated a scaffold Booking and when i ran rails console i have found that every time a add a new booking, a new booking id gets associated to it. Now i have deleted first and last booking and i want my booking id to rearrange from one.

I have tried:

  • ActiveRecord::Base.connection.execute("DELETE from sqlite_sequence where name = 'bookings'")
  • Truncate
  • delete from bookings
  • delete from sqlite_sequence where name='bookings';


database:Sqlite3
Rails:4.2.4

Aucun commentaire:

Enregistrer un commentaire