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 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.
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 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.
Thanks Colin for the resource and help!
My problem is resolved.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.