eBooru/db/migrate/20230312103728_timestamps_non_nullable.rb
Earlopain fc7d84affd
[RuboCop] Enable Style/FrozenStringLiteralComment
This reduces allocations on the posts page by about 5%, from basic testing
2024-02-25 18:15:55 +01:00

32 lines
1.0 KiB
Ruby

# frozen_string_literal: true
class TimestampsNonNullable < ActiveRecord::Migration[7.0]
def change
ApplicationRecord.without_timeout do
non_null_timestamps(:api_keys)
non_null_timestamps(:artist_versions)
non_null_timestamps(:bulk_update_requests)
non_null_timestamps(:comment_votes)
non_null_timestamps(:dmail_filters)
non_null_timestamps(:dmails)
non_null_timestamps(:forum_topic_visits)
non_null_timestamps(:forum_topics)
non_null_timestamps(:ip_bans)
non_null_timestamps(:mod_actions)
non_null_timestamps(:news_updates)
non_null_timestamps(:pool_versions)
non_null_timestamps(:post_votes)
non_null_timestamps(:uploads)
non_null_timestamps(:user_feedback)
non_null_timestamps(:user_name_change_requests)
non_null_timestamps(:user_password_reset_nonces)
change_column_null :users, :created_at, false
end
end
def non_null_timestamps(table)
change_column_null table, :created_at, false
change_column_null table, :updated_at, false
end
end