https://signup.heroku.com/login
https://dashboard.heroku.com/new-app
https://cli-assets.heroku.com/heroku-x64.exe
# clone先ディレクトリは任意(apacheのドキュメントルート配下は避ける)
$ cd /PATH/TO/LARAVELISBN
# フォルダ名は任意(アプリ名に合わせるか、複数設置したときに区別しやすいもの)
$ git clone https://github.com/YA-androidapp/Heroku-Isbn-Comics books
$ cd books
$ composer install
HerokuアプリケーションのResourceタブで Heroku Postgres
を検索して追加
DBeaver 推奨
HerokuアプリケーションのSettingsからReveal Config Varsを開く。 Heroku PostgresアドオンのSettingsのView Credentialsを参考に以下の環境変数を設定
- DATABASE_URL
- DB_CONNECTION pgsql
- DB_DATABASE
- DB_HOST
- DB_PASSWORD
- DB_USERNAME
- DEBUGBAR_ENABLED true
- LOG_CHANNEL errorlog
$ heroku pg:psql DATABASE_URL
$ heroku config:set APP_KEY=$(php artisan key:generate --show)
$ heroku run php artisan migrate
既存DBからデータをインポートした場合はincrementをきちんと動作させるために以下のSQLを実行
SELECT setval('users_id_seq', coalesce((SELECT MAX(id)+1 FROM users), 1), false);
SELECT setval('books_id_seq', coalesce((SELECT MAX(id)+1 FROM books), 1), false);
TrustProxies.php
に以下を追記
protected $proxies = '**';
Copyright © 2020 YA-androidapp(https://github.com/YA-androidapp) All rights reserved.