コマンドでマイグレーションファイルを作成
rails g migration [テーブル名]
rails g migration Osusume
add_index〜〜のところを追記して、rails db:migrateする
class Osusume < ActiveRecord::Migration[7.0]
def change
add_index :osusumes, [:title, :short_title], unique: true
end
end
Go to list of users who liked
Share on X(Twitter)
Share on Facebook
More than 3 years have passed since last update.
コマンドでマイグレーションファイルを作成
rails g migration [テーブル名]
rails g migration Osusume
add_index〜〜のところを追記して、rails db:migrateする
class Osusume < ActiveRecord::Migration[7.0]
def change
add_index :osusumes, [:title, :short_title], unique: true
end
end
Register as a new user and use Qiita more conveniently
Go to list of users who liked