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
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/10/21 11:54
2017/10/21 11:57
2017/10/21 14:11
2017/10/22 02:06
2017/10/22 07:07