2014-06-21 130 views
0

使用devise gem時無法使用postgresql獲取rake遷移數據庫。Postgresql和devise數據庫遷移失敗

rake db:migrate --trace 
** Invoke db:migrate (first_time) 
** Invoke environment (first_time) 
** Execute environment 
** Invoke db:load_config (first_time) 
** Execute db:load_config 
** Execute db:migrate 
** Invoke db:_dump (first_time) 
** Execute db:_dump 
** Invoke db:schema:dump (first_time) 
** Invoke environment 
** Invoke db:load_config 
** Execute db:schema:dump 

rake db:migrate:status回報什麼:

database: sampleapp_development 

Status Migration ID Migration Name 
-------------------------------------------------- 

如果我做rails g scaffold <WHATEVER> name email,我跑耙分貝:遷移這一切運作良好,但與色器件...什麼都沒有。

的Gemfile:

source 'https://rubygems.org' 


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '4.1.1' 
# Use postgresql as the database for Active Record 
gem 'pg' 
# Use SCSS for stylesheets 
gem 'bootstrap-generators', '~> 3.1.1' 
gem 'sass-rails', '~> 4.0.3' 
gem 'bootstrap-sass', '~> 3.1.1' 

gem 'simple_form' 

gem 'rails_12factor', group: :production 

gem 'devise' 

# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 
# Use CoffeeScript for .js.coffee assets and views 
gem 'coffee-rails', '~> 4.0.0' 
# See https://github.com/sstephenson/execjs#readme for more supported runtimes 
# gem 'therubyracer', platforms: :ruby 

# Use jquery as the JavaScript library 
gem 'jquery-rails' 
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 
gem 'turbolinks' 
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 2.0' 
# bundle exec rake doc:rails generates the API under doc/api. 
gem 'sdoc', '~> 0.4.0',   group: :doc 

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 
gem 'spring',  group: :development 

# Use ActiveModel has_secure_password 
# gem 'bcrypt', '~> 3.1.7' 

# Use unicorn as the app server 
# gem 'unicorn' 

# Use Capistrano for deployment 
# gem 'capistrano-rails', group: :development 

# Use debugger 
# gem 'debugger', group: [:development, :test] 
+0

你能看到設計的遷移文件生成嗎? –

+0

@nidhi是的,我是。我可以看到所有的遷移文件'20140621182346_devise_create_users' – fyz

+0

這很奇怪..任何機會,你可以嘗試刪除數據庫並再次運行所有遷移 –

回答

0

請檢查由設計所產生的遷移文件。有時它會生成一個帶有txt擴展名的文件,它不會運行你的遷移。

需要使用rb擴展名重命名文件以正確工作。