Last active
January 24, 2020 02:58
-
-
Save RNDcpp/ca037ed4309098b0561f98ca877d7b55 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreateRecommendations < ActiveRecord::Migration[5.2] | |
def change | |
- create_table :recommendations do |t| | |
+ create_table :recommendations, id: false do |t| # idの代わりにuidを使う | |
- t.bigint :uid | |
+ t.bigint :uid, null: false, unique: true | |
- t.blob :recommended_id_list | |
+ t.blob :recommended_id_list, null: false | |
- t.timestamps | |
+ t.datetime :updated_at, null: false # created_atは不要 | |
end | |
end | |
- add_index :recommendations, :uid | |
+ add_index :recommendations, :uid, unique: true | |
+ add_index :recommendations, :updated_at, unique: true | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment