# Changing the database from mysql to sqlite3 - need help

**URL:** <https://www.ruby-forum.com/t/changing-the-database-from-mysql-to-sqlite3-need-help/127284>\
**Category:** Rails\
**Created:** [January 27, 2008, 8:04pm UTC](https://www.ruby-forum.com/t/changing-the-database-from-mysql-to-sqlite3-need-help/127284 "2008-01-27T20:04:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![truetype](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/9e8a1a/32.png) [@truetype](https://www.ruby-forum.com/u/truetype)\
**Post date:** [January 27, 2008, 8:04pm UTC](https://www.ruby-forum.com/t/changing-the-database-from-mysql-to-sqlite3-need-help/127284/1 "2008-01-27T20:04:29Z")

</div>

As far as I know, the only thing you need to change is database.yaml.  
So I set up it, changing adapter from mysql to sqlite and pointing to  
the file, which should play a role of database. Now when I try to run  
rake db:create an error pops up saying “Could not find table ‘users’”.  
Why’s that and how to override this? By logic, db:create is only  
creating a blank database, without any table in it. So, what’s the  
deal with tables then?

Thanks

---

<div class="post-metadata">

**Author:** ![truetype](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/9e8a1a/32.png) [@truetype](https://www.ruby-forum.com/u/truetype)\
**Post date:** [January 27, 2008, 8:43pm UTC](https://www.ruby-forum.com/t/changing-the-database-from-mysql-to-sqlite3-need-help/127284/2 "2008-01-27T20:43:54Z")

</div>

I found solution.

The reason why rake aborted was that the environment.rb had some  
observers set up. It seems that these observers tried to communicate  
with a model, which table had not been created. That’s how it should  
be though - you can’t have a table for a model in the database, if you  
don’t have the database. And the error occurred when I was trying to  
run rake db:create. So, it seems now that the only solution is to  
comment observers in the environment.rb before creating the database  
and comment them when the database is created, which is a little  
stupid - who knows how much times I would need to drop database and  
create it again and now I need to comment and uncomment observers each  
time?

Does anyone know better solution?  
Thanks
