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.

自分用メモ

Last updated at Posted at 2023-04-29

pe + tabキーで <%= %>
er + tabキーで <% %>
行の複製 opt + shift + ↑/↓
ChatGPTで改行 Shiftキー + Enterキー

postgreSQLでソケットがないと言われてエラーが起きた際に役立った
https://techracho.bpsinc.jp/hachi8833/2017_12_21/48661

rm /usr/local/var/postgresql@14/postmaster.pid

・節の終わりに行う
$ git add -A
$ git commit -m "タイトル 例(Add a Static Pages controller)"
$ git push

・コード生成と取り消し
$ rails generate controller StaticPages home help
$ rails destroy controller StaticPages home help

・モデル生成と取り消し
$ rails generate model User name:string email:string
$ rails destroy model User

・マイグレーションの変更と元に戻す
$ rails db:migrate:status マイグレーションファイルの状態を確認する
$ rails db:migrate マイグレーションファイルを適用
$ rails db:rollback ひとつ前に戻す
$ rails db:migrate VERSION=0 最初の状態に戻す
https://qiita.com/yuya_maru2/items/87df1377cbef733c7647
https://ichigick.com/rails-edit-migration/

railsのモデルの属性を確認
https://qiita.com/kon_yu/items/5c173f5a8af6ad67eee7

本番環境のDBをリセットする
bin/render-build.shファイルを変更
-bundle exec rails db:migrate
+bundle exec rails db:migrate:reset
Renderダッシュボードの「Environment」から環境変数DISABLE_DATABASE_ENVIRONMENT_CHECKを追加
値は1
変更をコミットしデプロイ
リセットしたら忘れずに元に戻す

rails db:reset と rails db:migrate:resetについて
https://otaku-programmer.com/rails/db/migration/1/

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?