gpt4 book ai didi

ruby-on-rails - rake 数据库 :migrate issue postgresql

转载 作者:数据小太阳 更新时间:2023-10-29 08:09:16 26 4
gpt4 key购买 nike

我是 PostgreSQL、Ruby on Rails 的完全菜鸟..

我正在努力学习本教程(没有 ruby​​mine)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

最佳答案

这个怎么样:

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

关于ruby-on-rails - rake 数据库 :migrate issue postgresql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18605221/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com