Reputation: 5281
I had an app (based on this tutorial) that used to work. However, I now get the error:
Could not find table 'users'
I had to upgrade the version of Ruby I was using (from 2.0.0 to 2.4.4). With the newer Ruby version, I also had to use newer versions of some of the gems the app uses. In particular, a newer version of sqlite3 which manages the app's database.
Is the new sqlite3 the reason the table can no longer be found? What can I do to resolve the error? I assume upgrading the gem version did not delete the data the table previously contained...
Upvotes: 0
Views: 54
Reputation: 6862
If you're using SQLite and there's no db/development.sqlite3
file, something happened with it and you'll have to recreate your database. If this is the development environment and you can clean the database, run the following command:
RAILS_ENV=development rails db:drop db:create db:migrate db:seed
This is going to recreate the database, run the migrations and the seeds.rb
file.
Note: by default, Rails creates the .gitignore
file excluding .sqlite3
files. This is going to prevent the SQLite database to be versioned.
Upvotes: 1