Rails--bundle exec rake db:migrate

时间:2024-01-12 20:58:56

--新建表:

def up
create_table :[TABLE_NAME] do |t|
t.column :[NUM], :integer
t.column :[NAME], :string
t.column :[TIME], :timestamp
t.column :[ACTIVE], :boolean, :default => true
# 不推荐,用task rake
execute <<-SQL
[SQL-1];
[SQL-2];
SQL t.timestamps
end add_index :location_properties, :[NUM]
add_index :location_properties, :[NAME] , :unique => true end def down
drop_table :[TABLE_NAME]
end

--