Question: Rails' ActiveRecord doesn't see tables in SQLite3 database after migration

Question

Rails' ActiveRecord doesn't see tables in SQLite3 database after migration

Answers 0
Added at 2017-09-28 17:09
Tags
Question

I did rake db:drop rake db:create and rake db:migrate.

When I run sqlite console, I get the following:

sqlite> .tables
ar_internal_metadata  groups                schema_migrations   
entries               notifications         settings            
group_moderators      posts                 users               
group_subscriptions   profiles              votes               
sqlite> 

But when I run rails console, I get this

Loading development environment (Rails 5.1.4)
2.4.0 :001 > User.all
  User Load (0.4ms)  SELECT  "users".* FROM "users" LIMIT ?  [["LIMIT", 11]]
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: users: 
SELECT  "users".* FROM "users" LIMIT ?
2.4.0 :002 > ActiveRecord::Base.connection.tables
 => ["ar_internal_metadata"] 

What can I do to make ActiveRecord see those tables?

Answers to

Rails' ActiveRecord doesn't see tables in SQLite3 database after migration

Source Show
◀ Wstecz