質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

1回答

3601閲覧

herokuにうまくrailsのDBが反映されない

you88

総合スコア147

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2017/10/21 02:24

編集2017/10/22 07:07

herokuでrailsappをdeployしたいのですがdbがうまく反映されません。db以外のものはdeployできています。herokuのdbのファイルで指定すればいいんでしょうか?database.ymlは

# SQLite version 3.x # gem install sqlite3 # # Ensure the SQLite 3 gem is defined in your Gemfile # gem 'sqlite3' # default: &default adapter: sqlite3 pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> timeout: 5000 development: <<: *default database: db/development.sqlite3 # 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: <<: *default database: db/test.sqlite3 production: <<: *default adapter: postgresql username: tpevkaavpicadp host: ec2-54-163-249-237.compute-1.amazonaws.com:5432 database: daopn9j0e9smh4 password: 6b08b34fc6482c78b83595d037e2fd8da4e618bcd7ff78790386d71131bda18c database: db/production.sqlite3

でschemeは

# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your # database schema. If you need to create the application database on another # system, you should be using db:schema:load, not running all the migrations # from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 20171007030215) do create_table "comments", force: :cascade do |t| t.datetime "created_at", null: false t.datetime "updated_at", null: false t.text "comment" t.integer "user_id" t.integer "post_id" end create_table "posts", force: :cascade do |t| t.datetime "created_at", null: false t.datetime "updated_at", null: false t.text "content" t.integer "user_id" t.text "location" t.integer "gender" t.text "line_id" end create_table "users", force: :cascade do |t| t.datetime "created_at", null: false t.datetime "updated_at", null: false t.integer "icon_id" t.integer "icon_back_id" end end

なんですがcommenttableが反映されないのとなぜかposttableも一部しか反映されず。。。

20171022_追記

下記のmigrationファイルが反映されていないです。開発環境だとされています。

class RenameSexColumnToGender < ActiveRecord::Migration[5.1] def change rename_column :posts, :sex, :gender end end
class CreateComments < ActiveRecord::Migration[5.1] def change create_table :comments do |t| t.timestamps end end end
class Comments < ActiveRecord::Migration[5.1] def change add_column :comments, :comment, :text add_column :comments, :user_id, :integer add_column :comments, :post_id, :integer end end

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

heroku run rails db:migrateをしても反映されないということでしょうか?

投稿2017/10/21 08:00

kenny_sayama

総合スコア1036

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

you88

2017/10/21 11:54

はい、そうです。
kenny_sayama

2017/10/21 11:57

heroku run rails db:migrate:resetはどうでしょうか?
you88

2017/10/21 14:11

だめでした。。。
kenny_sayama

2017/10/22 02:06

一部が反映され、rails db:migrate:resetを行ってもダメということであれば、該当するmigrationファイルに異常がある可能性があります。 反映されない箇所と関連のあるmigrationファイルを添付いただけますでしょうか?
you88

2017/10/22 07:07

ありがとうございます。migrationファイルを追記しました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問