0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Rails:ローカルでのタスクとHerokuの環境設定やDB操作など

Last updated at Posted at 2022-02-10

ローカル環境

コンソールの準備

terminal
$ rails c

タスクの読み込み
これで schedular.rake のタスクを利用できる

terminal
$ Rails.application.load_tasks

タスクの実行

terminal
$ Rake::Task['タスク名'].execute

Heroku環境

ログ出力

terminal
$ heroku logs -t

環境変数の設定

terminal
$ heroku config:set キー="値"

環境変数の確認

terminal
$ heroku config

データベースの情報取得(どのデータベースをaddonで追加するかでも変わる。今回はPostgre)

terminal
$ heroku pg:credentials:url --app アプリ名

データベースの操作(どのデータベースをaddonで追加するかでも変わる)

terminal
$ heroku pg:psql -c SDL文
例) heroku pg:psql -c "select * from users;"
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?