Open pine0619 opened 3 years ago
docker-compose exec web rake db:migrate
する前に
docker-compose exec web ./bin/rails db:rollback
してデータベースに入っているデータがすべてリセットする
herokuでDBに保存する方法 写真はpublicに入れておく。
Image.create(place_name: "Hally’s Cafe", longitude: 26.245671, latitude: 127.739715, image_path: "hallys_cafe.jpg", instagram_link: "https://www.instagram.com/p/CGl2mKdnJqD/?utm_source=ig_web_copy_link")
Image.create(place_name: "麺道くろとん 宜野湾店", longitude: 26.262737, latitude: 127.752032, image_path: "kuroton.jpg", instagram_link: "https://www.instagram.com/p/CG30k5anzWr/?utm_source=ig_web_copy_link")
Image.create(place_name: "備瀬フクギの森", longitude: 26.702644, latitude: 127.881007, image_path: "hukugi.jpg")
Image.create(place_name: "ライカム", image_path: "rycom.jpg")
Image.create(place_name: "伊江水道", image_path: "ie_suidou.jpg")
Image.create(place_name: "名護湾", image_path: "nago_bay.jpg")
Image.create(place_name: "古宇利島", image_path: "kirei.jpg")
Image.create(place_name: "首里城", image_path: "kirei_shurijo.jpg")
Image.create(place_name: "奥武島", image_path: "Ou_Island.jpg")
Image.create(place_name: "那覇バスターミナル", image_path: "naha_bus_terminal.jpg")
Image.create(place_name: "アメリカンビレッジ", image_path: "mihama.jpg")
Image.create(place_name: "ウミカジテラス", image_path: "umikazi.jpg")
って感じでDBに入れていく。必須なのは、place_nameと、image_path
手動でデータをテーブルに保存する方法(ローカル)
コンテナ立ち上げ
docker-compose up -d
DBのmigrate
docker-compose exec web rake db:migrate
railsコンソールの立ち上げ
docker-compose exec web rails c
立ち上がったコンソール内でデータを入れる
用意している画像全部分データを入れる