I don''t really know, but I''ll take a guess.
It''s not generally considered good security practice for the web
application user ID to have broad database creation privileges. The
assumption is that at most the application''s database user ID should be
constrained to mucking around only with that application''s schema, in
which case something else would have to create the bare schema in the
first place and grant privileges on it to the Rails user.
While you _could_ have an initial migration create the database itself,
many real-world environments beyond a personal laptop or a cheap shared
hosting account often wouldn''t allow it, so it''s not a
practice I''d
personally expect to see in Rails tutorials.
Then again, maybe I''m way off base.
Jeff Pritchard wrote:> I''m just at the "reading various rails tutorials" stage.
>
> One thing that has puzzled me a couple of times so far is the fact that
> the creation of the database is not part of the "migration".
>
> The steps as I''ve seen them are always:
> 1) $ rails myapplication
> 2) $ mysqladmin yadda yadda to create a table
> 3) $ script/generate migration myWickedTable
> 4) put rows and columns in the migration script
> 5) $ rake migrate
>
> I''m just wondering why its not more like this:
> 1) $rails myapplication
> 2) $script/generate migration myWickedDatabase
> 3) put a table in the migration script
> 4) put rows and columns in the migration script
> 5) $ rake migrate
>
> It just seems odd that the creation of the database is seen as something
> special and previous to the other steps that are handled by rails. Why
> can''t (or shouldn''t) rails include that part of the
initial setup?
>
> thanks,
> jp
--
Posted via http://www.ruby-forum.com/.