On 28 November 2014 at 21:43, Dmoneyzzz Darko <lists@ruby-forum.com> wrote:
> I have this code placed in my project's bin/rails directory:
>
> #!/usr/bin/env ruby.exe
> APP_PATH = File.expand_path('../../config/application', __FILE__)
> require_relative '../config/boot'
> require 'rails/commands'
>
> generate migration add_physician_id_to_appointment
>
> and I then I ran a db:migrate.
>
> I don't think my code is placed correctly to generate a new migration
> file for my database. I am trying to create a standalone migration with
> the code below:
>
> class Appointment < ActiveRecord::Migration
> def change
> add_column :physician_id, :integer
> end
> end
>
> I am using this resource:
> http://guides.rubyonrails.org/migrations.html#creating-a-standalone-migration
I don't understand why you have made a file in bin/rails. There is no
need to do that. You must first generate the migration using the
command
rails generate migration ...
from the command line. That will generate the migration file in
db/migrate, then you have a look there to make sure it is correct and
then run
rake db:migrate
to apply the migration.
I suspect you are just starting with rails, in which case I recommend
working right through a good tutorial such as railstutorial.org (which
is free to use online). That will show you the basics of rails,
including how to use migrations.
Colin
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f6d0d58cebaf05d310bc194cd9c8ee6b%40ruby-forum.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvFBDA34576Tr4bsKfYRand38js49UdmtWtq9qYQCgBUw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment