2

I'm building a sample pre-sign up page where people can signup their email before the application launches. When I type in:

heroku open

I get the following error on my browser

We're sorry, but something went wrong.

If you are the application owner check the logs for more information.

After checking my logs, I found this weird error:

[36m2014-04-28T08:22:01.921791+00:00 app[web.1]:←[0m PG::UndefinedTable: ERROR:
 relation "premails" does not exist

what does that mean? I have the following migration:

class CreatePremails < ActiveRecord::Migration
  def change
    create_table :premails do |t|

        t.text :email

      t.timestamps
    end
  end
end

and model:

class Premail < ActiveRecord::Base

end

What do I need to do to make it deploy on Heroku? I am not sure if that is the problem or if perhaps I need to change my database.yml file. currently I have this in there:

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: sqlite3
  database: db/production.sqlite3
  pool: 5
  timeout: 5000

Since Heroku only works on pg maybe I need to make a change there?

Some additional information, here is my Gemfile:

source 'https://rubygems.org'


gem 'pg'

gem 'bootstrap-sass', '~> 3.1.1'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.3'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

# 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', '~> 1.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

group :production do
  gem 'rails_12factor', '0.0.2'
end

I am on Windows8 64

Thanks!

user3408293
  • 1,377
  • 6
  • 18
  • 26

1 Answers1

6

Several issues:

  1. You've not set a "real" production database
  2. You've not used rake db:migrate in production

Firstly, you need to create a production db to run on Heroku. Heroku does not host any db for you - it only runs on the Amazon EC2 stack; meaning you have to either prodivde your own DB server, or use one of Heroku's postgres instances

After you have a production database, you'll just need to run heroku run rake db:migrate from your command-line to get all your tables populated on the db server, which should resolve the error

Richard Peck
  • 76,116
  • 9
  • 93
  • 147