db: add non-null constraints to all non-optional columns.

Add non-null constraints to all columns that are non-optional. Now the
only columns that are nullable are optional columns.
This commit is contained in:
evazion
2021-03-30 04:52:01 -05:00
parent 803efe8501
commit 247934ad83
2 changed files with 40 additions and 18 deletions

View File

@@ -0,0 +1,21 @@
class SetNotNullOnMultipleColumns < ActiveRecord::Migration[6.1]
def change
change_column_null :bans, :user_id, false
change_column_null :dmails, :is_spam, false
change_column_null :forum_topic_visits, :user_id, false
change_column_null :forum_topic_visits, :forum_topic_id, false
change_column_null :forum_topic_visits, :last_read_at, false
change_column_null :mod_actions, :category, false
change_column_null :pixiv_ugoira_frame_data, :post_id, false
change_column_null :pools, :name, false
change_column_null :post_appeals, :reason, false
change_column_null :post_flags, :reason, false
change_column_null :posts, :image_width, false
change_column_null :posts, :image_height, false
change_column_null :saved_searches, :user_id, false
change_column_null :saved_searches, :query, false
change_column_null :user_name_change_requests, :original_name, false
change_column_null :user_name_change_requests, :desired_name, false
change_column_null :users, :bcrypt_password_hash, false
end
end