Archivo de la etiqueta: amazon-ec2

Migrations are pending. To resolve this issue, run: bin/rake db:migrate RAILS_ENV=development, works localy tho

I have a weird error that has been bugging me for a while now. When I run the server local the site shows up perfect but when I try to access it on my aws EC2 I get the error “ActiveRecord::PendingMigrationError
Migrations are pending. To resolve this issue, run: bin/rake db:migrate RAILS_ENV=development”
So I ran the command “bin/rake db:migrate RAILS_ENV=development” and this prints out.

bin/rake db:migrate RAILS_ENV=development
Running via Spring preloader in process 30908
== 20160812175638 CreatePosts: migrating ======================================
-- create_table(:posts)
   -> 0.0014s
== 20160812175638 CreatePosts: migrated (0.0017s) =============================

== 20160813194710 DeviseCreateUsers: migrating ================================
-- create_table(:users)
   -> 0.0015s
-- add_index(:users, :email, {:unique=>true})
   -> 0.0005s
-- add_index(:users, :reset_password_token, {:unique=>true})
   -> 0.0007s
== 20160813194710 DeviseCreateUsers: migrated (0.0031s) =======================

== 20160912112653 AddAttachmentImageToPosts: migrating ========================
-- change_table(:posts)
   -> 0.0012s
== 20160912112653 AddAttachmentImageToPosts: migrated (0.0013s) ===============

but I still get the same msg. So I did some searching on the net and I have read all the pages here on this issue and haven’t found nothing.

When I run “rake db:migrate:status” I see this:

Status   Migration ID    Migration Name
   up     20160812175638  Create posts
   up     20160813194710  Devise create users
   up     20160912112653  Add attachment image to posts

And when I do “rake db:version” I get this:

Current version: 20160912112653

“rails -v” gives me

Rails 4.2.6

and “cat Gemfile | grep rails” gives me this:# Bundle edge Rails instead:

gem 'rails', github: 'rails/rails'
gem 'rails'
gem 'sass-rails', '~> 5.0'
gem 'coffee-rails', '~> 4.1.0'
# See for more supported runtimes
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more:
# Build JSON APIs with ease. Read more:
# bundle exec rake doc:rails generates the API under doc/api.
# gem 'capistrano-rails', group: :development
  # Spring speeds up development by keeping your application running in the background. Read more:

I’m at loss here, it works just fine on local and it worked just fine if I edit away /data/ from database.rb file.

default: &default
  adapter: sqlite3
  pool: 5
  timeout: 5000

  <<: *default
  database: db/data/development.sqlite3
  <<: *default
  database: db/test.sqlite3

  <<: *default
  database: db/data/production.sqlite3

But if I do that the database gets wiped as soon as I update the site with my redeploy script which is running docker-compose for me.

I quite sure that I’ve missed a simple thing that gives me this error tho since the site do work on the localhost.