>  Q&A  >  본문

ruby - Error adding decimal column: precision cannot be empty

数据库迁移文件如下

class CreateWorks < ActiveRecord::Migration
  def change
    create_table :works do |t|
      t.integer :project_id
      t.integer :user_id
      t.datetime :datetimeperformed
      t.decimal :hours, percision: 5, scale: 2
      t.timestamps null: false
    end
  end
end

执行:

rake db:migrate 

报错
Error adding decimal column: precision cannot be empty if scale is specified

不知道是什么原因,请帮忙看一下,谢谢!

天蓬老师天蓬老师2710일 전614

모든 응답(1)나는 대답할 것이다

  • 天蓬老师

    天蓬老师2017-04-24 09:15:08

    해결되었습니다. 정밀도의 철자가 잘못되었습니다!

    회신하다
    0
  • 취소회신하다