Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rake db:migrate issue postgresql

I'm complete noob at PostgreSQL, Ruby on Rails..

I'm trying to follow this tutorial (WITHOUT rubymine) http://www.codeproject.com/Articles/575551/User-Authentication-in-Ruby-on-Rails#InstallingRubyMine4

I have as such this to migrate (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

The error I'm getting goes like this:

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

...
C:131071:in 'disable_dll_transaction'
Task:TOP => db:migrate
like image 605
Ahmad Bilal Avatar asked Mar 25 '26 04:03

Ahmad Bilal


1 Answers

What about this:

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
like image 148
Benjamin Tan Wei Hao Avatar answered Mar 26 '26 16:03

Benjamin Tan Wei Hao



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!