`
juliancg65
  • 浏览: 14966 次
  • 性别: Icon_minigender_1
  • 来自: 上海
最近访客 更多访客>>
社区版块
存档分类
最新评论

转载 Rake 操作

阅读更多

命令行

script/generate model task name:string priority:integer  
script/generate migration add_description_to_task description:string  
script/generate migration remove_description_from_task description:string



数据类型

# :string, :text, :integer, :float,:decimal, :datetime, :timestamp, :time, :date,
# :binary, :boolean



与db有关的rake任务
[code=“Ruby"]
db:charset 检索当前环境下数据库的字符设置  
db:collation 检索当前环境下数据库的校对  
db:create 用config\database.yml中的定义创建当前 RAILS_ENV 项目环境下的数据库  
db:create:all 用config\database.yml中的定义创建所有数据库  
db:drop 删除当前 RAILS_ENV项目环境中的数据库  
db:drop:all 删除所有在 config\database.yml中定义的数据库  
db:reset 从db\schema.rb中为当前环境重建数据库(先删后建).  
db:rollback 回滚(清华出版社一本SQLSERVER书的名词[很奇怪为什么不直接用滚回])数据库到前一个版本. 指定回滚到哪一步要用 STEP=n 参数  
db:version 检索当前模式下的版本  


drop all tables
[code=“Ruby"]
rake db:migrate VERSION=0 


定义数字精确度
[code=“Ruby"]
t.integer :total_price, :precision=>8,:scale=>2,:default=>0 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics