LoginSignup
0
0

More than 3 years have passed since last update.

MySQLエラー

Last updated at Posted at 2020-04-04

https://gyazo.com/f195fd0a8fbb6c3d52e4fb46746af2f8
priceのカラムがない
追加して解決

ローカル環境
作業中のディレクトリ
カラム追加
rails g migration Addカラム名To追加元テーブル名 追加するカラム名:型
rails g migration AddNicknameToUsers nickname:string
rails db:migrate

カラム削除
例:rails g migration Removeカラム名From削除元テーブル名 削除するカラム名:型
rails g migration RemoveNameFromTweets name:string
rails db:migrate

本番環境
作業中のディレクトリ
mysql -u root                        起動
SHOW DATABASES;                     データベース参照
USE データベース名;                     データベースに移動
SHOW TABLES;                      テーブル参照
ALTER TABLE テーブル名 ADD カラム名 カラムの型;      カラム追加
ALTER TABLE テーブル名 DROP カラム名;           カラム削除

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