내 응용 프로그램을 제작할 준비가되어 있고 데이터베이스를 긁어 모으는 데 어려움을 겪고 있습니다. 여기 PG :: UndefinedTable 오류 ruby on rails heroku
PG::UndefinedTable: ERROR: relation "events" does not exist
: ALTER TABLE "events" ADD "code" character varying
내 database.yml을 파일입니다 : 그것은 나에게이 오류주고있다
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
편집 : 여기
# 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
을 내 이벤트 마이그레이션 파일입니다 때 I rake db:migrate:status
을 실행하면 다음 결과가 표시됩니다. 당신은 내가 데이 문제를 해결하기 위해 필요 아무것도가있는 경우
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"
맞쳐 알고 : 마지막으로, 여기 내 gemfile입니다. 감사합니다 : D
그럼 어떻게이 두 순서를 바꿀까요? – Aaron
@Aaron 이렇게하면 마이그레이션 순서를 변경하는 데 도움이됩니다. http://stackoverflow.com/questions/10456761/rails-migration-change-sequence-or-order 한편 임시 수정을 시도 할 수 있습니다. – Deep
은 매력처럼 작동했습니다. 이제 제 제작 응용 프로그램을 볼 수 있습니다. – Aaron