# Creating tables within the app rather than manual configure

**URL:** <https://www.ruby-forum.com/t/creating-tables-within-the-app-rather-than-manual-configure/105174>\
**Category:** Rails\
**Created:** [May 26, 2007, 5:35pm UTC](https://www.ruby-forum.com/t/creating-tables-within-the-app-rather-than-manual-configure/105174 "2007-05-26T17:35:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![patwa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b77776/32.png) [@patwa](https://www.ruby-forum.com/u/patwa)\
**Post date:** [May 26, 2007, 5:35pm UTC](https://www.ruby-forum.com/t/creating-tables-within-the-app-rather-than-manual-configure/105174/1 "2007-05-26T17:35:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![patwa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b77776/32.png) [@patwa](https://www.ruby-forum.com/u/patwa)\
**Post date:** [May 26, 2007, 9:21pm UTC](https://www.ruby-forum.com/t/creating-tables-within-the-app-rather-than-manual-configure/105174/2 "2007-05-26T21:21:31Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![patwa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b77776/32.png) [@patwa](https://www.ruby-forum.com/u/patwa)\
**Post date:** [May 27, 2007, 8:20pm UTC](https://www.ruby-forum.com/t/creating-tables-within-the-app-rather-than-manual-configure/105174/3 "2007-05-27T20:20:46Z")

</div>

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. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![patwa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b77776/32.png) [@patwa](https://www.ruby-forum.com/u/patwa)\
**Post date:** [May 27, 2007, 10:39pm UTC](https://www.ruby-forum.com/t/creating-tables-within-the-app-rather-than-manual-configure/105174/4 "2007-05-27T22:39:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![patwa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b77776/32.png) [@patwa](https://www.ruby-forum.com/u/patwa)\
**Post date:** [May 27, 2007, 8:50pm UTC](https://www.ruby-forum.com/t/creating-tables-within-the-app-rather-than-manual-configure/105174/5 "2007-05-27T20:50:52Z")

</div>

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. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![patwa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b77776/32.png) [@patwa](https://www.ruby-forum.com/u/patwa)\
**Post date:** [May 28, 2007, 8:08pm UTC](https://www.ruby-forum.com/t/creating-tables-within-the-app-rather-than-manual-configure/105174/6 "2007-05-28T20:08:29Z")

</div>

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 🙂
