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 3 years have passed since last update.

Ruby on rails データベース操作の最低限知るべきコマンド

Posted at

⚫︎データベース操作作成

#Model作成
$ rails g model <model名> カラム名:型  

#Modelと対応するmigrationファイル作成
$ rails g migration <migration名> カラム名:型

#データベース作成
$ rails db:create

##データベース削除
$ rails db:drop

#migration データベースへの反映
$ rails db:migrate

#migration データベースを元に戻す
$ rails db:rollback

#初期でデータ投入
$ rails db:seed

#データベースのリセット
$ rails db:reset    *基本は使わないのがおすすめ

#データベースリセット
$ rails db:migrate:reset *ゼロからmigrationファイルを実行してDBを再作成するコマンド

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?