1

I have seen many examples where sqlite is used for the testing database and postgres/mysql for development.

What are the implications of this strategy?

There are obvious differences between the two databases, and it seems theoretically possible that a test which would pass on one could fail on the other.

3
  • its definitely possible: when you write find_by_sql methods Commented Nov 29, 2013 at 10:07
  • I guess sqlite is faster as well? Commented Nov 29, 2013 at 17:33
  • it's namely... lite :) Commented Nov 29, 2013 at 17:34

4 Answers 4

1

I guess, it's for simplicity. With sqlite, a developer doesn't need to install a full-blown DB server on his machine. It'll "just work". Very useful for tutorials, etc.

But then, of course, it can bite you in the hind parts (as you correctly noted). In real development of real application you should use the same databases in all environments.

Sign up to request clarification or add additional context in comments.

4 Comments

I think that's a big guess. I think a developer who can't install postgres should get a different job.
Don't underestimate power of simplicity. Sqlite works well for simple scenarios (read toy projects/tutorials), so why add complexity? Anyhow, do you have another theory?
Simplicity is beautiful no doubts. My point is adding sqlite to the mix in a postgres "manufacturing" process in the dev environment makes no sense and actually adds unknowns and complexities. Do you like your car manufactured and tested with a go-kart engine and released to you with a v8 that they stick in at the end of the build process with no testing?
Given the other comments, I think yours is the right answer, thank you!
0

Yes, I completely agree with Sergio. These guidelines could be useful where everything has been done in a rails way but this is not always the case with real production apps. Not only just the database but each and every details should be replicated to test/staging machines including DB timezone and global variables or settings or configurations.

Comments

0

That is 99.9% wrong to do. There may very well be some extreme edge case where you could argue doing this, though I can't think of one and probably won't in this life time.

Postgres is free why would even consider replacing sqlite in another environment? I hope my data doesn't live on these systems, they sound like a ball of yarn at best if this is the type of decisions that are being made.

A competent engineer strives to replicate the system from dev to production not deviate from that in places where it makes no sense.

Comments

0

SQLite is a more simpler database than PostgreSQL or MySQL, and if you are testing "very small" applications you can easily use it instead of PostgreSQL. But I would not recommend it because:

  • It's not the same that you will use in production. Try to use always the same Database Engine if possible, even the version should be the same. After all you want to assure that when it goes live, everything will work fine.
  • If you have some kind of complex logic on the database, you won't be able to test it on Sqlite.
  • You wont be able to test database configurations that are specific to one Database Engine.

Basicly test as you will deliver, unless it's not possible, in that case try the most look a like option.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.