Hi all,
I am new to ROR and I use RadRails for ROR. I start a project and create
a model,a scaffold, and a table. It works fine. The table contains two
columns. Later on I need to add one more column to the table and I find
I can’t update the table. I wonder if anyone out there please gives me a
hand.
Thanks,
Li
############# original table with 2 columns in file
db\migrate\001_create_employees.rb
class CreateEmployees < ActiveRecord::Migration
def self.up
create_table :employees do |t|
t.column :name,:string
t.column :hiredate,:date
end
end
def self.down
drop_table :employees
end
end
########### in file db\schema.rb
ActiveRecord::Schema.define(:version => 1) do
create_table “employees”, :force => true do |t|
t.column “name”, :string
t.column “hiredate”, :date
end
end
######later on add one more column to the new table
class CreateEmployees < ActiveRecord::Migration
def self.up
create_table :employees do |t|
t.column :name,:string
t.column :hiredate,:date
t.column :salary,:float
end
end
def self.down
drop_table :employees
end
end
########### in file db\schema.rb
ActiveRecord::Schema.define(:version => 1) do
create_table “employees”, :force => true do |t|
t.column “name”, :string
t.column “hiredate”, :date
end
end
##there is no change to the schema.rb. WHY??? and how?