The choice to use sqlite3 as the default database was a great idea.
But it's far less common for Windows users to even know about sqlite3
than MySQL. So right out of the gate this can present an unpleasant
experience for new users.
I've created a patch which modifies the app generator to use sqlite3
if the sqlite3-ruby gem can be found. If not, the default database
will revert back to MySQL.
I’d suggest mySQL is just as uncommon as sqlite3 on Windows
machines. Installing mySQL takes more effort and
knowledge than installing sqlite3. If you want a default on a Windows
machine I’d think SQL Server 2005 would be the choice, not mySQL.
A default is arbitrary anyways, so I’d say, let’s be a fascist all
the way: sqlite3. period.
Having one default for all systems means: less code (all 3 lines of
those ;), less documentation, less confusion.
I’m for mislav’s suggestion that this is more a matter of documentation.
And perhaps a user friendly bail message when things bomb (if that
isn’t given already)
I disagree with that. I don't know anyone who uses SQL Server unless
they have to (especially with Rails). Installing mySQL is as simple
as downloading the installer and running it.
I think the sqlite default makes sense; I would guess the majority of
Rails developers are probably on some sort of *nix or a derivative, so
this isn't much of an issue.
1) Defaults should be constant imho, not variable.
I generally agree, but I think a reasonable degrade approach is
necessary here.
2) I'd suggest mySQL is just as uncommon as sqlite3 on Windows machines.
Installing mySQL takes more effort and knowledge than installing
sqlite3. If you want a default on a Windows machine I'd think SQL Server
2005 would be the choice, not mySQL.
I would agree with that, but since SQLServer was pulled from core in
2.0, I don't think it would be good to make it the default in any
scenario. Of all of the open-source databases that Rails supports out
of the box in 2.0, Windows users will at least have heard of MySQL and
a little googling finds wide acceptance among big-name companies. I
think SQLLite, however, is hardly known at all.
The scenario I'm trying to solve is this:
1. Windows developer wants to take the brave step of trying out Rails.
2. She picks up any Rails book on the market, finds out she needs to
install MySQL and the Ruby One-Click Installer, and does a gem install
rails
3. She types "rails hello_world" and creates one model
4. Big Problems
3) A default is arbitrary anyways, so I'd say, let's be a fascist all
the way: sqlite3. period.
4) Having one default for all systems means: less code (all 3 lines of
those ;), less documentation, less confusion.
I'm for mislav's suggestion that this is more a matter of documentation.
And perhaps a user friendly bail message when things bomb (if that isn't
given already)
Perhaps I should change the --help text to read, "Default: sqlite3 (or
MySQL if sqlite3 gem is not found)." ? That would be fine with me.
I would agree with that, but since SQLServer was pulled from core in
2.0, I don’t think it would be good to make it the default in any
scenario
Agree 100%.
Of all of the open-source databases that Rails supports out
of the box in 2.0, Windows users will at least have heard of MySQL and
a little googling finds wide acceptance among big-name companies. I
think SQLLite, however, is hardly known at all.
One way of fixing the popularity problem is to use just sqlite in the default install. A lot of Windows developers could well discover that sqlite is easier to use (no need to monkey with admin interfaces and permissions; rake db:create just works) and every bit as good for their needs as mysql. Personally, I use sqlite for development and mysql for production. It’s a great setup. I’m surprised I didn’t try sqlite until Rails 2.0 suggested it.
The scenario I’m trying to solve is this:
Windows developer wants to take the brave step of trying out Rails.
She picks up any Rails book on the market, finds out she needs to
install MySQL and the Ruby One-Click Installer, and does a gem install
rails
She types “rails hello_world” and creates one model
Big Problems
Every book I’ve seen starts with setting up database.yaml. You omit that step and then worry that the user’s app won’t work. Well, if you omit that step with Rails 1.2
, your app will have Big Problems too! (I think you’re overstating your case a wee bit).
There will also be Big Problems when the user tries to use pagination or list examples… or the functional test examples shown in the book… etc. I don’t think anybody expects a book on Rails 1.0 is going to be fully compatible with Rails 2.0.
Perhaps I should change the --help text to read, "Default: sqlite3 (or
MySQL if sqlite3 gem is not found)." ? That would be fine with me.
That’s still arbitrarily modifying the defaults isn’t it? Seems to me like this will cause more trouble than it solves.
I really don’t think Windows users are as clueless as you make them out to be. The majority of them anyway.
For what it's worth, I fully agree with Scott. I'd prefer to stick to
one default database. Sqlite is really easy to install on windows
(easier than MySQL) and generating a MySQL based rails app, really
isn't that hard.
My suggestion: let's stick to sqlite for a little while, if that's
really a problem we can always re evaluate the situation later on.
Yeah, shocking that there are still some people using the OS that has 90%
of the desktop market share...
FWIW, I have three Mac laptops. But for ergonomics, I need to work at a
desktop, and there are still a decent number of Windows apps I prefer to
their Mac equivalents. Only in the past year have Parallels and VM Fusion
(and Adobe CS3 native!) made it really feasible for us hard-core Windows
users to consider switching without starting from scratch. Personally,
I've promised myself an 8-core Mac Pro Penryn this January, assuming the
rumors are true.
(Hopefully this won't start a platform war; I just wanted to remind people
that developers with Windows desktops do exist, despite what you may see at
RailsConf.)
That said, building Ruby-plus-gems from scratch is so difficult and
error-prone on Windows right now that *anyone* trying Rails is going to be
using the One-Click Installer or Instant Rails or something like that.
So if they were to start packaging SQLite (and maybe they already do), that
could solve the problem without having differing Rails defaults. Honestly,
I don't think MySQL has that much better mindshare on Windows. Either
you're involved in open source, in which case you know about MySQL and
Postgres and SQLite, or you're not, in which case you know about MS Access
and Jet and SQL Server and whatever Microsoft's latest lite-desktop-SQL
engine is called.
That's a good point. If the OCI included SQLite this patch would
never have occurred to me. Looking back I wish that perhaps DHH could
have coordinated with Curt Hibbs, but perhaps that was impossible to
foresee at the time.
I do sympathize with other points of view here. I also wince a bit at
having this dynamic default. I just couldn't think of anything better
and this might really bite hard for Windows users using 2.0 in the
near future. If the core decides to wait and see before applying the
patch, that would be fine with me, too.
For me SQLite is a better choice because the default database Rails uses is constant across all platforms. And maybe it's just me, but I like the idea of having a *vendor agnostic* DB used by default (we are not advertising MySQL AB that puts enterprise subscription ads even in documentation now and acts_as_enterprisey every way they can; but still for serious geospatial apps you have to go with Postgres because MySQL puts their efforts in marketing, not in database development).
Right. That's why I gave this a +1 - only because it seemed like it
would make it easier for people to learn rails out of the box on
Windows.
It's not at all about what's more consistent, or what is cleaner code,
or what is a better database. In my opinion, the new-user ease of use
trumps all those reasons, because experienced users can use ERB to
make the database.yml do whatever they want wherever they want. It's
just a config file.