2010-04-29 76 views
0

我試圖讓我的Web服務器上運行我的Rails應用程序,但是當我運行耙分貝:遷移我收到以下錯誤:服務器語法錯誤的Rails?

[R

[email protected] [/home/macandco/rails_apps/survey_manager]# rake db:migrate 
(in /home/macandco/rails_apps/survey_manager) 
== Baseapp: migrating ======================================================== 
-- create_table(:settings, {:force=>true}) 
    -> 0.0072s 
-- create_table(:users) 
    -> 0.0072s 
-- add_index(:users, :login, {:unique=>true}) 
    -> 0.0097s 
-- create_table(:profiles) 
    -> 0.0084s 
-- create_table(:open_id_authentication_associations, {:force=>true}) 
    -> 0.0067s 
-- create_table(:open_id_authentication_nonces, {:force=>true}) 
    -> 0.0064s 
-- create_table(:roles) 
    -> 0.0052s 
-- create_table(:roles_users, {:id=>false}) 
    -> 0.0060s 
rake aborted! 
An error has occurred, all later migrations canceled: 

555 5.5.2 Syntax error. g9sm2526951gvc.8 

有沒有人遇到過嗎?

感謝,

丹尼

主要遷移文件

Ç

lass Baseapp < ActiveRecord::Migration 
    def self.up 

    # Create Settings Table 
    create_table :settings, :force => true do |t| 
     t.string :label 
     t.string :identifier 
     t.text :description 
     t.string :field_type, :default => 'string' 
     t.text :value 

     t.timestamps 
    end 

    # Create Users Table 
    create_table :users do |t| 
     t.string :login, :limit => 40 
     t.string :identity_url  
     t.string :name, :limit => 100, :default => '', :null => true 
     t.string :email, :limit => 100 
     t.string :mobile 
     t.string :signaturenotes 
     t.string :crypted_password, :limit => 40 
     t.string :salt, :limit => 40 
     t.string :remember_token, :limit => 40 
     t.string :activation_code, :limit => 40 
     t.string :state, :null => :false, :default => 'passive'  
     t.datetime :remember_token_expires_at 
     t.string :password_reset_code, :default => nil 
     t.datetime :activated_at 
     t.datetime :deleted_at 
     t.timestamps 
    end 

    add_index :users, :login, :unique => true 

    # Create Profile Table 
    create_table :profiles do |t| 
     t.references :user 

     t.string :real_name 
     t.string :location 
     t.string :website 
     t.string :mobile 

     t.timestamps 
    end 

    # Create OpenID Tables 
    create_table :open_id_authentication_associations, :force => true do |t| 
     t.integer :issued, :lifetime 
     t.string :handle, :assoc_type 
     t.binary :server_url, :secret 
    end 

    create_table :open_id_authentication_nonces, :force => true do |t| 
     t.integer :timestamp, :null => false 
     t.string :server_url, :null => true 
     t.string :salt, :null => false 
    end 

    create_table :roles do |t| 
     t.column :name, :string 
    end 

    # generate the join table 
    create_table :roles_users, :id => false do |t| 
     t.column :role_id, :integer 
     t.column :user_id, :integer 
    end 

    # Create admin role and user 
    admin_role = Role.create(:name => 'admin') 

    user = User.create do |u| 
     u.login = 'admin' 
     u.password = u.password_confirmation = 'XXXXXXXXX' 
     u.email = '[email protected]' 
    end 

    user.register! 
    user.activate! 

    user.roles << admin_role 
    end 

    def self.down 
    # Drop all BaseApp 
    drop_table :settings 
    drop_table :users 
    drop_table :profiles 
    drop_table :open_id_authentication_associations 
    drop_table :open_id_authentication_nonces 
    drop_table :roles 
    drop_table :roles_users 
    end 
end 
+0

你可以發佈你的遷移文件嗎?上面添加了主要遷移文件 – 2010-04-29 16:55:35

+0

。 – dannymcc 2010-04-29 17:01:15

+0

你有'role'和'user'模型,對吧? 'password_confirmation'是一種方法嗎? – 2010-04-29 17:41:20

回答

1

555 5.5.2 Syntax錯誤是從電子郵件創建用戶後發送。看起來你仍然有電子郵件發送問題。

請注意......您不需要在遷移過程中發送電子郵件。

+0

它不應該在遷移過程中發送電子郵件?它在哪裏陳述? – dannymcc 2010-04-29 17:44:43

+0

啊,我明白了。我刪除了這部分: #創建管理員角色和用戶 admin_role = Role.create(:name =>'admin') user = User.create do | u | u.login = '管理員' u.password = u.password_confirmation = 'XXXX' u.email = '[email protected]' 結束 user.register! user.activate! user.roles << admin_role 並且它成功運行。 謝謝,我現在可以嘗試找出爲什麼它仍然心不是運行:d 感謝, 丹尼 – dannymcc 2010-04-29 17:48:45

+0

我的意思是我沒有意識到它發送遷移過程中的電子郵件,並要求它指出,順便把代碼。 – dannymcc 2010-04-29 17:52:36