[Sinatra] How to run "rake db:migrate"
  • With Sinatra and ActiveRecord, one needs to define migrations in the db/migrate directory and then run the command "rake db:migrate" from the root of the Sinatra app. What is the equivalent of "rake db:migrate" on dotgeek?
  • can't you just specify the DB info and establish a connection ? you can then run this locally and upload the files. As long as the config.ru points to the sinatra app + your database config files is fine it will run.
  • Hello gurugeek and thanks for taking the time to respond.
    The question is not about specifying the DB info and establishing the connection inside the Sinatra app. The question is about how one needs to define the DB schema before one can issue INSERTs and SELECTs from inside the end-user-visible app. The developers who created ActiveRecord have found a smart, scripted solution to running CREATE TABLE and CREATE INDEX commands. The solution is called ActiveRecord migrations and it consists of Rubyfying those CREATE statements and running them in one batch using a command called "rake db:migrate". The ActiveRecord developers have specifically made migrations a separate process (not triggerable from inside the app) because of security considerations.
    If there is no way you can expose a "rake db:migrate" button in the admin panel, that's OK, I will find a way to run those DDL (data definition language) commands from inside the publicly exposed Sinatra app.
    I just wanted to point out how things are done in the Ruby world.
    Consider it a feature request if you will :)
  • thanks for the note I will look into this. I am using Camping in Ruby and I just define
    it differently and do not need to run rake db::migrate. We can probably add it but I would just create the app tables (via a script for example or phpmyadmin ) and simply run the app :)

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook


Share Me

  • Please share this topic with your friends. Click any of the icons below:
  • stumbleupon
  • Twitter
  • facebook
  • myspace
  • technorati
  • reddit
  • fark
  • email