From cf7e8409909e1ea02dff9056133449d6cbd34d72 Mon Sep 17 00:00:00 2001 From: Daniel Hunsaker Date: Sun, 12 Nov 2017 08:18:50 -0700 Subject: [PATCH] Update model annotations to use BIGINT for IDs (#5461) All the migrations have been updated to use BIGINTs for ID fields in the DB, but ActiveRecord needs to be told to treat those values as BIGINT as well. This PR does that. --- app/models/account.rb | 2 +- app/models/account_domain_block.rb | 4 ++-- app/models/account_moderation_note.rb | 6 +++--- app/models/block.rb | 6 +++--- app/models/conversation.rb | 2 +- app/models/conversation_mute.rb | 6 +++--- app/models/custom_emoji.rb | 2 +- app/models/domain_block.rb | 2 +- app/models/email_domain_block.rb | 2 +- app/models/favourite.rb | 6 +++--- app/models/follow.rb | 6 +++--- app/models/follow_request.rb | 6 +++--- app/models/import.rb | 4 ++-- app/models/media_attachment.rb | 6 +++--- app/models/mention.rb | 6 +++--- app/models/mute.rb | 6 +++--- app/models/notification.rb | 8 ++++---- app/models/preview_card.rb | 2 +- app/models/report.rb | 8 ++++---- app/models/session_activation.rb | 14 +++++++------- app/models/setting.rb | 4 ++-- app/models/site_upload.rb | 2 +- app/models/status.rb | 14 +++++++------- app/models/status_pin.rb | 6 +++--- app/models/stream_entry.rb | 6 +++--- app/models/subscription.rb | 4 ++-- app/models/tag.rb | 2 +- app/models/user.rb | 4 ++-- app/models/web/push_subscription.rb | 2 +- app/models/web/setting.rb | 4 ++-- 30 files changed, 76 insertions(+), 76 deletions(-) diff --git a/app/models/account.rb b/app/models/account.rb index 7e4d29f96ee..6f6010f7af1 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -3,7 +3,7 @@ # # Table name: accounts # -# id :integer not null, primary key +# id :bigint not null, primary key # username :string default(""), not null # domain :string # secret :string default(""), not null diff --git a/app/models/account_domain_block.rb b/app/models/account_domain_block.rb index fb695e473e4..9c98ec2a6fc 100644 --- a/app/models/account_domain_block.rb +++ b/app/models/account_domain_block.rb @@ -6,8 +6,8 @@ # domain :string # created_at :datetime not null # updated_at :datetime not null -# account_id :integer -# id :integer not null, primary key +# account_id :bigint +# id :bigint not null, primary key # class AccountDomainBlock < ApplicationRecord diff --git a/app/models/account_moderation_note.rb b/app/models/account_moderation_note.rb index 3ac9b1ac142..06f464850c5 100644 --- a/app/models/account_moderation_note.rb +++ b/app/models/account_moderation_note.rb @@ -3,10 +3,10 @@ # # Table name: account_moderation_notes # -# id :integer not null, primary key +# id :bigint not null, primary key # content :text not null -# account_id :integer not null -# target_account_id :integer not null +# account_id :bigint not null +# target_account_id :bigint not null # created_at :datetime not null # updated_at :datetime not null # diff --git a/app/models/block.rb b/app/models/block.rb index a913782eddc..5778f7e90ba 100644 --- a/app/models/block.rb +++ b/app/models/block.rb @@ -5,9 +5,9 @@ # # created_at :datetime not null # updated_at :datetime not null -# account_id :integer not null -# id :integer not null, primary key -# target_account_id :integer not null +# account_id :bigint not null +# id :bigint not null, primary key +# target_account_id :bigint not null # class Block < ApplicationRecord diff --git a/app/models/conversation.rb b/app/models/conversation.rb index 08c1ce94589..e0853252257 100644 --- a/app/models/conversation.rb +++ b/app/models/conversation.rb @@ -3,7 +3,7 @@ # # Table name: conversations # -# id :integer not null, primary key +# id :bigint not null, primary key # uri :string # created_at :datetime not null # updated_at :datetime not null diff --git a/app/models/conversation_mute.rb b/app/models/conversation_mute.rb index 8d2399adf52..316865bd27d 100644 --- a/app/models/conversation_mute.rb +++ b/app/models/conversation_mute.rb @@ -3,9 +3,9 @@ # # Table name: conversation_mutes # -# conversation_id :integer not null -# account_id :integer not null -# id :integer not null, primary key +# conversation_id :bigint not null +# account_id :bigint not null +# id :bigint not null, primary key # class ConversationMute < ApplicationRecord diff --git a/app/models/custom_emoji.rb b/app/models/custom_emoji.rb index a77b53c98b3..5723ebd5db7 100644 --- a/app/models/custom_emoji.rb +++ b/app/models/custom_emoji.rb @@ -3,7 +3,7 @@ # # Table name: custom_emojis # -# id :integer not null, primary key +# id :bigint not null, primary key # shortcode :string default(""), not null # domain :string # image_file_name :string diff --git a/app/models/domain_block.rb b/app/models/domain_block.rb index 1268290bc0c..557d0a19c79 100644 --- a/app/models/domain_block.rb +++ b/app/models/domain_block.rb @@ -8,7 +8,7 @@ # updated_at :datetime not null # severity :integer default("silence") # reject_media :boolean default(FALSE), not null -# id :integer not null, primary key +# id :bigint not null, primary key # class DomainBlock < ApplicationRecord diff --git a/app/models/email_domain_block.rb b/app/models/email_domain_block.rb index 839038bea6d..51410605bdd 100644 --- a/app/models/email_domain_block.rb +++ b/app/models/email_domain_block.rb @@ -3,7 +3,7 @@ # # Table name: email_domain_blocks # -# id :integer not null, primary key +# id :bigint not null, primary key # domain :string not null # created_at :datetime not null # updated_at :datetime not null diff --git a/app/models/favourite.rb b/app/models/favourite.rb index d28d5c05b93..f611aa6a99e 100644 --- a/app/models/favourite.rb +++ b/app/models/favourite.rb @@ -5,9 +5,9 @@ # # created_at :datetime not null # updated_at :datetime not null -# account_id :integer not null -# id :integer not null, primary key -# status_id :integer not null +# account_id :bigint not null +# id :bigint not null, primary key +# status_id :bigint not null # class Favourite < ApplicationRecord diff --git a/app/models/follow.rb b/app/models/follow.rb index 667720a88f3..3d5447fb1f0 100644 --- a/app/models/follow.rb +++ b/app/models/follow.rb @@ -5,9 +5,9 @@ # # created_at :datetime not null # updated_at :datetime not null -# account_id :integer not null -# id :integer not null, primary key -# target_account_id :integer not null +# account_id :bigint not null +# id :bigint not null, primary key +# target_account_id :bigint not null # class Follow < ApplicationRecord diff --git a/app/models/follow_request.rb b/app/models/follow_request.rb index 458bcd28a8a..ce27fc92149 100644 --- a/app/models/follow_request.rb +++ b/app/models/follow_request.rb @@ -5,9 +5,9 @@ # # created_at :datetime not null # updated_at :datetime not null -# account_id :integer not null -# id :integer not null, primary key -# target_account_id :integer not null +# account_id :bigint not null +# id :bigint not null, primary key +# target_account_id :bigint not null # class FollowRequest < ApplicationRecord diff --git a/app/models/import.rb b/app/models/import.rb index 8ae7e3a46f8..6f127855660 100644 --- a/app/models/import.rb +++ b/app/models/import.rb @@ -11,8 +11,8 @@ # data_content_type :string # data_file_size :integer # data_updated_at :datetime -# account_id :integer not null -# id :integer not null, primary key +# account_id :bigint not null +# id :bigint not null, primary key # class Import < ApplicationRecord diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb index 60380198b34..f0541892551 100644 --- a/app/models/media_attachment.rb +++ b/app/models/media_attachment.rb @@ -3,14 +3,14 @@ # # Table name: media_attachments # -# id :integer not null, primary key -# status_id :integer +# id :bigint not null, primary key +# status_id :bigint # file_file_name :string # file_content_type :string # file_file_size :integer # file_updated_at :datetime # remote_url :string default(""), not null -# account_id :integer +# account_id :bigint # created_at :datetime not null # updated_at :datetime not null # shortcode :string diff --git a/app/models/mention.rb b/app/models/mention.rb index 3700c781c8c..fc089d36593 100644 --- a/app/models/mention.rb +++ b/app/models/mention.rb @@ -3,11 +3,11 @@ # # Table name: mentions # -# status_id :integer +# status_id :bigint # created_at :datetime not null # updated_at :datetime not null -# account_id :integer -# id :integer not null, primary key +# account_id :bigint +# id :bigint not null, primary key # class Mention < ApplicationRecord diff --git a/app/models/mute.rb b/app/models/mute.rb index 6e64848c766..4174a35234c 100644 --- a/app/models/mute.rb +++ b/app/models/mute.rb @@ -5,9 +5,9 @@ # # created_at :datetime not null # updated_at :datetime not null -# account_id :integer not null -# id :integer not null, primary key -# target_account_id :integer not null +# account_id :bigint not null +# id :bigint not null, primary key +# target_account_id :bigint not null # class Mute < ApplicationRecord diff --git a/app/models/notification.rb b/app/models/notification.rb index 0a5d987cfec..c88af9021b1 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -3,13 +3,13 @@ # # Table name: notifications # -# id :integer not null, primary key -# account_id :integer -# activity_id :integer +# id :bigint not null, primary key +# account_id :bigint +# activity_id :bigint # activity_type :string # created_at :datetime not null # updated_at :datetime not null -# from_account_id :integer +# from_account_id :bigint # class Notification < ApplicationRecord diff --git a/app/models/preview_card.rb b/app/models/preview_card.rb index e2bf65d9477..63c04b410e4 100644 --- a/app/models/preview_card.rb +++ b/app/models/preview_card.rb @@ -3,7 +3,7 @@ # # Table name: preview_cards # -# id :integer not null, primary key +# id :bigint not null, primary key # url :string default(""), not null # title :string default(""), not null # description :string default(""), not null diff --git a/app/models/report.rb b/app/models/report.rb index bffb42b481f..99c90b7dd2a 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -8,10 +8,10 @@ # action_taken :boolean default(FALSE), not null # created_at :datetime not null # updated_at :datetime not null -# account_id :integer not null -# action_taken_by_account_id :integer -# id :integer not null, primary key -# target_account_id :integer not null +# account_id :bigint not null +# action_taken_by_account_id :bigint +# id :bigint not null, primary key +# target_account_id :bigint not null # class Report < ApplicationRecord diff --git a/app/models/session_activation.rb b/app/models/session_activation.rb index c1645223bda..59565f8775a 100644 --- a/app/models/session_activation.rb +++ b/app/models/session_activation.rb @@ -3,25 +3,25 @@ # # Table name: session_activations # -# id :integer not null, primary key -# user_id :integer not null +# id :bigint not null, primary key +# user_id :bigint not null # session_id :string not null # created_at :datetime not null # updated_at :datetime not null # user_agent :string default(""), not null # ip :inet -# access_token_id :integer -# web_push_subscription_id :integer +# access_token_id :bigint +# web_push_subscription_id :bigint # -# id :integer not null, primary key -# user_id :integer not null +# id :bigint not null, primary key +# user_id :bigint not null # session_id :string not null # created_at :datetime not null # updated_at :datetime not null # user_agent :string default(""), not null # ip :inet -# access_token_id :integer +# access_token_id :bigint # class SessionActivation < ApplicationRecord diff --git a/app/models/setting.rb b/app/models/setting.rb index a14f156a1e7..be68d3123b3 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -8,8 +8,8 @@ # thing_type :string # created_at :datetime # updated_at :datetime -# id :integer not null, primary key -# thing_id :integer +# id :bigint not null, primary key +# thing_id :bigint # class Setting < RailsSettings::Base diff --git a/app/models/site_upload.rb b/app/models/site_upload.rb index 8ffdc831313..ba2ca777b88 100644 --- a/app/models/site_upload.rb +++ b/app/models/site_upload.rb @@ -3,7 +3,7 @@ # # Table name: site_uploads # -# id :integer not null, primary key +# id :bigint not null, primary key # var :string default(""), not null # file_file_name :string # file_content_type :string diff --git a/app/models/status.rb b/app/models/status.rb index 5a72456135e..b4f31431178 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -3,25 +3,25 @@ # # Table name: statuses # -# id :integer not null, primary key +# id :bigint not null, primary key # uri :string -# account_id :integer not null +# account_id :bigint not null # text :text default(""), not null # created_at :datetime not null # updated_at :datetime not null -# in_reply_to_id :integer -# reblog_of_id :integer +# in_reply_to_id :bigint +# reblog_of_id :bigint # url :string # sensitive :boolean default(FALSE), not null # visibility :integer default("public"), not null -# in_reply_to_account_id :integer -# application_id :integer +# in_reply_to_account_id :bigint +# application_id :bigint # spoiler_text :text default(""), not null # reply :boolean default(FALSE), not null # favourites_count :integer default(0), not null # reblogs_count :integer default(0), not null # language :string -# conversation_id :integer +# conversation_id :bigint # local :boolean # diff --git a/app/models/status_pin.rb b/app/models/status_pin.rb index a72c19750eb..5795d07bf98 100644 --- a/app/models/status_pin.rb +++ b/app/models/status_pin.rb @@ -3,9 +3,9 @@ # # Table name: status_pins # -# id :integer not null, primary key -# account_id :integer not null -# status_id :integer not null +# id :bigint not null, primary key +# account_id :bigint not null +# status_id :bigint not null # created_at :datetime not null # updated_at :datetime not null # diff --git a/app/models/stream_entry.rb b/app/models/stream_entry.rb index b51fe9ad76d..50b900c3cbb 100644 --- a/app/models/stream_entry.rb +++ b/app/models/stream_entry.rb @@ -3,13 +3,13 @@ # # Table name: stream_entries # -# activity_id :integer +# activity_id :bigint # activity_type :string # created_at :datetime not null # updated_at :datetime not null # hidden :boolean default(FALSE), not null -# account_id :integer -# id :integer not null, primary key +# account_id :bigint +# id :bigint not null, primary key # class StreamEntry < ApplicationRecord diff --git a/app/models/subscription.rb b/app/models/subscription.rb index 39860196b2c..bc50c531765 100644 --- a/app/models/subscription.rb +++ b/app/models/subscription.rb @@ -11,8 +11,8 @@ # updated_at :datetime not null # last_successful_delivery_at :datetime # domain :string -# account_id :integer not null -# id :integer not null, primary key +# account_id :bigint not null +# id :bigint not null, primary key # class Subscription < ApplicationRecord diff --git a/app/models/tag.rb b/app/models/tag.rb index 0fa08e157c8..6ebaf114595 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -3,7 +3,7 @@ # # Table name: tags # -# id :integer not null, primary key +# id :bigint not null, primary key # name :string default(""), not null # created_at :datetime not null # updated_at :datetime not null diff --git a/app/models/user.rb b/app/models/user.rb index 9022e6ea8ce..ebe768c523e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -3,7 +3,7 @@ # # Table name: users # -# id :integer not null, primary key +# id :bigint not null, primary key # email :string default(""), not null # created_at :datetime not null # updated_at :datetime not null @@ -30,7 +30,7 @@ # last_emailed_at :datetime # otp_backup_codes :string is an Array # filtered_languages :string default([]), not null, is an Array -# account_id :integer not null +# account_id :bigint not null # disabled :boolean default(FALSE), not null # moderator :boolean default(FALSE), not null # diff --git a/app/models/web/push_subscription.rb b/app/models/web/push_subscription.rb index cb15dfa3703..da67e766533 100644 --- a/app/models/web/push_subscription.rb +++ b/app/models/web/push_subscription.rb @@ -3,7 +3,7 @@ # # Table name: web_push_subscriptions # -# id :integer not null, primary key +# id :bigint not null, primary key # endpoint :string not null # key_p256dh :string not null # key_auth :string not null diff --git a/app/models/web/setting.rb b/app/models/web/setting.rb index 1b0bfb2b7b5..6d08c4d3553 100644 --- a/app/models/web/setting.rb +++ b/app/models/web/setting.rb @@ -6,8 +6,8 @@ # data :json # created_at :datetime not null # updated_at :datetime not null -# id :integer not null, primary key -# user_id :integer +# id :bigint not null, primary key +# user_id :bigint # class Web::Setting < ApplicationRecord