rake db:migrate问题postgresql

时间:2013-09-04 04:04:35

标签: ruby-on-rails ruby postgresql dbmigrate

我在PostgreSQL,Ruby on Rails上完成了noob ..

我正在尝试按照本教程(没有rubymine)http://www.codeproject.com/Articles/575551/User-Authentication-in-Ruby-on-Rails#InstallingRubyMine4

我有这样的迁移(001_create_user_model.rb):

class CreateUserModel < ActiveRecord::Migration
  def self.up
    create_table :users do |t|
      t.column :username, :string
      t.column :email, :string
      t.column :password_hash, :string
      t.column :password_salt, :string
    end
  end

  def self.down
    drop_table :users
  end
end

我得到的错误是这样的:

syntax error, unexpected ':', expecting ';' or '\n'
        t.column...sers do |t|

...
C:131071:in 'disable_dll_transaction'
Task:TOP => db:migrate

1 个答案:

答案 0 :(得分:1)

这个怎么样:

class CreateUserModel < ActiveRecord::Migration
  def self.up
    create_table :users do |t|
      t.string :username, :null => false
      t.string :email,:null => false
      t.string :password_hash, :null => false
      t.string :password_salt, :null => false
      t.timestamps
    end
  end

  def self.down
    drop_table :users
  end
end