Creating tables within the app rather than manual configure

Hello,

Was wondering if anyone working with Ruby on Rails could advise?

I am developing a blog for my site, but was thinking of also having it
as an application which I could distribute. To this end I would want
the application to generate the tables for the database itself, instead
of requiring that they be manually set up using either the command line
or PHPMyAdmin or whatever. Is this possible? Then if the tables are
already there it does nothing. It would mean that anyone could take the
app, it would run the first time and do all the setup needed, with the
only modifications to the code necessary being the adaption of the
database.yml file to tell it the name, username, etc of the databases.

I’m new to Rails so if you could please take this into account when
explaining, thanks for your time.

thanks.

H.

Hussein P. wrote:

Hello,

Was wondering if anyone working with Ruby on Rails could advise?

I am developing a blog for my site, but was thinking of also having it
as an application which I could distribute. To this end I would want
the application to generate the tables for the database itself, instead
of requiring that they be manually set up using either the command line
or PHPMyAdmin or whatever. Is this possible? Then if the tables are
already there it does nothing. It would mean that anyone could take the
app, it would run the first time and do all the setup needed, with the
only modifications to the code necessary being the adaption of the
database.yml file to tell it the name, username, etc of the databases.

I’m new to Rails so if you could please take this into account when
explaining, thanks for your time.

thanks.

H.

You can do install.rb file similar to some PHP web application! and
setup all the requirements you need :slight_smile:

I know you said that you didn’t want to require setup using the
command line, but I believe what you want to do is taken care of by
the bootstrap rake task.

I typically set up a bootstrap task that will create all the tables
necessary for the application to run on a new server. You can either
setup capistrano to run this after updating the code on the remote
server, or you can run it yourself on the command line with a simple
“rake db:bootstrap:load”

On May 26, 8:35 am, Hussein P. [email protected]

You can maybe inject rake migrate into the bootsetup for your
application :slight_smile:

Hi, thanks for the tip. I’d never heard of either the bootstrap or
capistrano but I’ll do some research into it. I’m using the rake
migrate function at the moment, which is fine for my own deployment but
not something I’d want to have for distributed software (as in software
made available to other people, not remote distribution).

H.

jacqui wrote:

I know you said that you didn’t want to require setup using the
command line, but I believe what you want to do is taken care of by
the bootstrap rake task.

I typically set up a bootstrap task that will create all the tables
necessary for the application to run on a new server. You can either
setup capistrano to run this after updating the code on the remote
server, or you can run it yourself on the command line with a simple
“rake db:bootstrap:load”

On May 26, 8:35 am, Hussein P. [email protected]

Thanks again. I found what looks to be a nice reference of bootstrap
commands so I’ll look at it once I have finished developing the app.
The app is mainly a development to suit my own needs, but it would be
nice to join the club of people who’ve made their own software available
to the public.

H.

Jamal S. wrote:

You can maybe inject rake migrate into the bootsetup for your
application :slight_smile: