0
我一直在讓我的應用程序準備好生產,而我正在努力耙取我的數據庫。它給我這個錯誤:PG :: UndefinedTable錯誤ruby on rails heroku
PG::UndefinedTable: ERROR: relation "events" does not exist
: ALTER TABLE "events" ADD "code" character varying
這裏是我的database.yml文件:
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default: &default
adapter: postgresql
pool: 5
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
production:
<<: *default
database: db/production.postgresql
這裏是我的事件遷移文件:
class CreateEvents < ActiveRecord::Migration[5.0]
def change
create_table :events do |t|
t.string :name
t.string :partycode
t.references :user, foreign_key: true
t.timestamps
end
end
end
編輯: 當我運行rake db:migrate:status
我收到以下結果: 最後,這裏是我的gemfile:
source 'http://rubygems.org'
gem 'bootstrap-sass', '3.2.0.2'
gem 'bcrypt', '3.1.11'
gem 'will_paginate'
gem 'responders'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
gem 'puma', '~> 3.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem "heroku"
gem 'coffee-script-source', '1.8.0'
gem 'jquery-rails'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'sqlite3'
gem 'byebug', platform: :mri
end
group :production do
gem 'web-console'
gem 'pg'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
ruby "2.2.4"
知道是否還有其他東西需要解決我遇到的問題。謝謝:d
那麼我該如何去改變這兩個的順序呢? – Aaron
@Aaron這可能會幫助您http://stackoverflow.com/questions/10456761/rails-migration-change-sequence-or-order更改遷移順序。同時你可以嘗試臨時修復。 – Deep
就像一個魅力,我現在可以看到我的生產applicaiton – Aaron