I have a problem with schema.rb in Rails. If i run rake db:migrate
the results are different for different databases, to be precise if I use PostgreSQL and a text field it gives me
t.text "summary"
line, but with SQLite it gives me
t.text "summary", :limit => 255
Also when I use :default
, number of spaces differ, PostgreSQL:
t.boolean "watched", :default => false, :null => false
SQLite:
t.boolean "watched", :default => false, :null => false
It is quite annoying that when I run rake db:migrate
on production it changes my schema.rb and obviously I can't use rake db:schema:load
on production when using schema.rb generated in development environment. My question is why are there differences and how do I make them disappear, so schema.rb is the same for production and development?
For your own sanity, I'd recommend using the same DB engine in development as you do in production. It doesn't take too much effort to get up and running with a local PostgreSQL server, and you'll avoid some nasty surprises by doing all of your development and testing on the same backend you're using in production.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With