diff --git a/db/migrate/20140801095807_devise_create_users.rb b/db/migrate/20140801095807_devise_create_users.rb index 0115292e..85ab1dfb 100644 --- a/db/migrate/20140801095807_devise_create_users.rb +++ b/db/migrate/20140801095807_devise_create_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class DeviseCreateUsers < ActiveRecord::Migration[4.2] def change create_table(:users) do |t| @@ -30,7 +32,6 @@ class DeviseCreateUsers < ActiveRecord::Migration[4.2] # t.string :unlock_token # Only if unlock strategy is :email or :both # t.datetime :locked_at - t.timestamps end diff --git a/db/migrate/20140801103309_add_screen_name_to_users.rb b/db/migrate/20140801103309_add_screen_name_to_users.rb index ad028c8f..a54abe42 100644 --- a/db/migrate/20140801103309_add_screen_name_to_users.rb +++ b/db/migrate/20140801103309_add_screen_name_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddScreenNameToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :screen_name, :string diff --git a/db/migrate/20140801174930_create_questions.rb b/db/migrate/20140801174930_create_questions.rb index ae872a7e..962748db 100644 --- a/db/migrate/20140801174930_create_questions.rb +++ b/db/migrate/20140801174930_create_questions.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateQuestions < ActiveRecord::Migration[4.2] def change create_table :questions do |t| @@ -9,6 +11,6 @@ class CreateQuestions < ActiveRecord::Migration[4.2] t.timestamps end - add_index :questions, [:user_id, :created_at] + add_index :questions, %i[user_id created_at] end end diff --git a/db/migrate/20140801175112_create_answers.rb b/db/migrate/20140801175112_create_answers.rb index 510d73bc..21eff7a1 100644 --- a/db/migrate/20140801175112_create_answers.rb +++ b/db/migrate/20140801175112_create_answers.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateAnswers < ActiveRecord::Migration[4.2] def change create_table :answers do |t| @@ -9,6 +11,6 @@ class CreateAnswers < ActiveRecord::Migration[4.2] t.timestamps end - add_index :answers, [:user_id, :created_at] + add_index :answers, %i[user_id created_at] end end diff --git a/db/migrate/20140801175137_create_comments.rb b/db/migrate/20140801175137_create_comments.rb index cb785fff..9d90f710 100644 --- a/db/migrate/20140801175137_create_comments.rb +++ b/db/migrate/20140801175137_create_comments.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateComments < ActiveRecord::Migration[4.2] def change create_table :comments do |t| @@ -7,6 +9,6 @@ class CreateComments < ActiveRecord::Migration[4.2] t.timestamps end - add_index :comments, [:user_id, :created_at] + add_index :comments, %i[user_id created_at] end end diff --git a/db/migrate/20141102153520_add_counts_to_users.rb b/db/migrate/20141102153520_add_counts_to_users.rb index 37db7152..92f934d3 100644 --- a/db/migrate/20141102153520_add_counts_to_users.rb +++ b/db/migrate/20141102153520_add_counts_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddCountsToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :friend_count, :integer, default: 0, null: false diff --git a/db/migrate/20141104143648_add_display_name_to_users.rb b/db/migrate/20141104143648_add_display_name_to_users.rb index 6db1c1c1..0ce6171c 100644 --- a/db/migrate/20141104143648_add_display_name_to_users.rb +++ b/db/migrate/20141104143648_add_display_name_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddDisplayNameToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :display_name, :string diff --git a/db/migrate/20141110210154_create_inboxes.rb b/db/migrate/20141110210154_create_inboxes.rb index bfb140d0..cbed4da6 100644 --- a/db/migrate/20141110210154_create_inboxes.rb +++ b/db/migrate/20141110210154_create_inboxes.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateInboxes < ActiveRecord::Migration[4.2] def change create_table :inboxes do |t| diff --git a/db/migrate/20141113164048_add_smile_count_to_answers.rb b/db/migrate/20141113164048_add_smile_count_to_answers.rb index c40b7166..16346497 100644 --- a/db/migrate/20141113164048_add_smile_count_to_answers.rb +++ b/db/migrate/20141113164048_add_smile_count_to_answers.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddSmileCountToAnswers < ActiveRecord::Migration[4.2] def change add_column :answers, :smile_count, :integer, default: 0, null: false diff --git a/db/migrate/20141113164314_add_smiled_count_to_users.rb b/db/migrate/20141113164314_add_smiled_count_to_users.rb index dda9e08b..b88e3e4d 100644 --- a/db/migrate/20141113164314_add_smiled_count_to_users.rb +++ b/db/migrate/20141113164314_add_smiled_count_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddSmiledCountToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :smiled_count, :integer, default: 0, null: false diff --git a/db/migrate/20141126154451_add_admin_to_users.rb b/db/migrate/20141126154451_add_admin_to_users.rb index d225ea61..3a745490 100644 --- a/db/migrate/20141126154451_add_admin_to_users.rb +++ b/db/migrate/20141126154451_add_admin_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddAdminToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :admin, :boolean, default: false, null: false diff --git a/db/migrate/20141129211448_add_motivation_header_to_users.rb b/db/migrate/20141129211448_add_motivation_header_to_users.rb index 7cd1d6dd..b87c1382 100644 --- a/db/migrate/20141129211448_add_motivation_header_to_users.rb +++ b/db/migrate/20141129211448_add_motivation_header_to_users.rb @@ -1,5 +1,7 @@ +# frozen_string_literal: true + class AddMotivationHeaderToUsers < ActiveRecord::Migration[4.2] def change - add_column :users, :motivation_header, :string, default: '', null: false + add_column :users, :motivation_header, :string, default: "", null: false end end diff --git a/db/migrate/20141130130221_create_relationships.rb b/db/migrate/20141130130221_create_relationships.rb index 98ab31e8..6b28185d 100644 --- a/db/migrate/20141130130221_create_relationships.rb +++ b/db/migrate/20141130130221_create_relationships.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateRelationships < ActiveRecord::Migration[4.2] def change create_table :relationships do |t| @@ -9,6 +11,6 @@ class CreateRelationships < ActiveRecord::Migration[4.2] add_index :relationships, :source_id add_index :relationships, :target_id - add_index :relationships, [:source_id, :target_id], unique: true + add_index :relationships, %i[source_id target_id], unique: true end end diff --git a/db/migrate/20141130175749_create_smiles.rb b/db/migrate/20141130175749_create_smiles.rb index de5004b4..3650c00d 100644 --- a/db/migrate/20141130175749_create_smiles.rb +++ b/db/migrate/20141130175749_create_smiles.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateSmiles < ActiveRecord::Migration[4.2] def change create_table :smiles do |t| @@ -9,6 +11,6 @@ class CreateSmiles < ActiveRecord::Migration[4.2] add_index :smiles, :user_id add_index :smiles, :answer_id - add_index :smiles, [:user_id, :answer_id], unique: true + add_index :smiles, %i[user_id answer_id], unique: true end end diff --git a/db/migrate/20141130180152_rename_columns_in_answers.rb b/db/migrate/20141130180152_rename_columns_in_answers.rb index 0a3fac1f..a94551c5 100644 --- a/db/migrate/20141130180152_rename_columns_in_answers.rb +++ b/db/migrate/20141130180152_rename_columns_in_answers.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class RenameColumnsInAnswers < ActiveRecord::Migration[4.2] def change rename_column :answers, :comments, :comment_count diff --git a/db/migrate/20141201191324_add_fields_to_users.rb b/db/migrate/20141201191324_add_fields_to_users.rb index 6ba0d729..38a18cf6 100644 --- a/db/migrate/20141201191324_add_fields_to_users.rb +++ b/db/migrate/20141201191324_add_fields_to_users.rb @@ -1,7 +1,9 @@ +# frozen_string_literal: true + class AddFieldsToUsers < ActiveRecord::Migration[4.2] def change - add_column :users, :website, :string, default: '', null: false - add_column :users, :location, :string, default: '', null: false - add_column :users, :bio, :text, default: '', null: false + add_column :users, :website, :string, default: "", null: false + add_column :users, :location, :string, default: "", null: false + add_column :users, :bio, :text, default: "", null: false end end diff --git a/db/migrate/20141207194424_add_answer_count_to_questions.rb b/db/migrate/20141207194424_add_answer_count_to_questions.rb index ff3acb3e..1ad3ee56 100644 --- a/db/migrate/20141207194424_add_answer_count_to_questions.rb +++ b/db/migrate/20141207194424_add_answer_count_to_questions.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddAnswerCountToQuestions < ActiveRecord::Migration[4.2] def change add_column :questions, :answer_count, :integer, default: 0, null: false diff --git a/db/migrate/20141208111714_change_answer_content_column_type.rb b/db/migrate/20141208111714_change_answer_content_column_type.rb index 454b897c..f704a5d5 100644 --- a/db/migrate/20141208111714_change_answer_content_column_type.rb +++ b/db/migrate/20141208111714_change_answer_content_column_type.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ChangeAnswerContentColumnType < ActiveRecord::Migration[4.2] def change change_table :answers do |t| diff --git a/db/migrate/20141212193625_create_services.rb b/db/migrate/20141212193625_create_services.rb index 7426d605..471a51d0 100644 --- a/db/migrate/20141212193625_create_services.rb +++ b/db/migrate/20141212193625_create_services.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateServices < ActiveRecord::Migration[4.2] def change create_table :services do |t| diff --git a/db/migrate/20141213182609_create_notifications.rb b/db/migrate/20141213182609_create_notifications.rb index a3fa3bcc..c8652cb9 100644 --- a/db/migrate/20141213182609_create_notifications.rb +++ b/db/migrate/20141213182609_create_notifications.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateNotifications < ActiveRecord::Migration[4.2] def change create_table :notifications do |t| diff --git a/db/migrate/20141226115905_add_moderator_to_users.rb b/db/migrate/20141226115905_add_moderator_to_users.rb index 1ef1db05..db9b3d8e 100644 --- a/db/migrate/20141226115905_add_moderator_to_users.rb +++ b/db/migrate/20141226115905_add_moderator_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddModeratorToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :moderator, :boolean, default: false, null: false diff --git a/db/migrate/20141227130438_create_reports.rb b/db/migrate/20141227130438_create_reports.rb index ce3c795c..932bf9b4 100644 --- a/db/migrate/20141227130438_create_reports.rb +++ b/db/migrate/20141227130438_create_reports.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateReports < ActiveRecord::Migration[4.2] def change create_table :reports do |t| diff --git a/db/migrate/20141227130545_create_moderation_votes.rb b/db/migrate/20141227130545_create_moderation_votes.rb index 4e73c91a..14a3543e 100644 --- a/db/migrate/20141227130545_create_moderation_votes.rb +++ b/db/migrate/20141227130545_create_moderation_votes.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateModerationVotes < ActiveRecord::Migration[4.2] def change create_table :moderation_votes do |t| @@ -10,6 +12,6 @@ class CreateModerationVotes < ActiveRecord::Migration[4.2] add_index :moderation_votes, :user_id add_index :moderation_votes, :report_id - add_index :moderation_votes, [:user_id, :report_id], unique: true + add_index :moderation_votes, %i[user_id report_id], unique: true end end diff --git a/db/migrate/20141227130618_create_moderation_comments.rb b/db/migrate/20141227130618_create_moderation_comments.rb index c06d8410..8c1025a7 100644 --- a/db/migrate/20141227130618_create_moderation_comments.rb +++ b/db/migrate/20141227130618_create_moderation_comments.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateModerationComments < ActiveRecord::Migration[4.2] def change create_table :moderation_comments do |t| @@ -8,6 +10,6 @@ class CreateModerationComments < ActiveRecord::Migration[4.2] t.timestamps end - add_index :moderation_comments, [:user_id, :created_at] + add_index :moderation_comments, %i[user_id created_at] end end diff --git a/db/migrate/20141228202825_add_deleted_to_reports.rb b/db/migrate/20141228202825_add_deleted_to_reports.rb index c8c6d343..d849baa8 100644 --- a/db/migrate/20141228202825_add_deleted_to_reports.rb +++ b/db/migrate/20141228202825_add_deleted_to_reports.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddDeletedToReports < ActiveRecord::Migration[4.2] def change add_column :reports, :deleted, :boolean, default: false diff --git a/db/migrate/20141229085904_add_attachment_profile_picture_to_users.rb b/db/migrate/20141229085904_add_attachment_profile_picture_to_users.rb index ff05535d..24d3accf 100644 --- a/db/migrate/20141229085904_add_attachment_profile_picture_to_users.rb +++ b/db/migrate/20141229085904_add_attachment_profile_picture_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddAttachmentProfilePictureToUsers < ActiveRecord::Migration[4.2] def self.up change_table :users do |t| diff --git a/db/migrate/20141229105013_add_profile_picture_processing_to_users.rb b/db/migrate/20141229105013_add_profile_picture_processing_to_users.rb index 0832cc17..47d882e8 100644 --- a/db/migrate/20141229105013_add_profile_picture_processing_to_users.rb +++ b/db/migrate/20141229105013_add_profile_picture_processing_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddProfilePictureProcessingToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :profile_picture_processing, :boolean diff --git a/db/migrate/20141229133149_add_crop_values_to_users.rb b/db/migrate/20141229133149_add_crop_values_to_users.rb index 8da16793..a41eab5d 100644 --- a/db/migrate/20141229133149_add_crop_values_to_users.rb +++ b/db/migrate/20141229133149_add_crop_values_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddCropValuesToUsers < ActiveRecord::Migration[4.2] def change # this is a ugly hack and will stay until I find a way to pass parameters diff --git a/db/migrate/20150102231343_add_supporter_to_users.rb b/db/migrate/20150102231343_add_supporter_to_users.rb index e23d5eb2..1cc574a9 100644 --- a/db/migrate/20150102231343_add_supporter_to_users.rb +++ b/db/migrate/20150102231343_add_supporter_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddSupporterToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :supporter, :boolean, default: false diff --git a/db/migrate/20150103200732_add_privacy_options_to_users.rb b/db/migrate/20150103200732_add_privacy_options_to_users.rb index 2d7ec342..cfe87cda 100644 --- a/db/migrate/20150103200732_add_privacy_options_to_users.rb +++ b/db/migrate/20150103200732_add_privacy_options_to_users.rb @@ -1,11 +1,13 @@ +# frozen_string_literal: true + class AddPrivacyOptionsToUsers < ActiveRecord::Migration[4.2] def change - %i{ + %i[ privacy_allow_anonymous_questions privacy_allow_public_timeline privacy_allow_stranger_answers privacy_show_in_search - }.each do |sym| + ].each do |sym| add_column :users, sym, :boolean, default: true end end diff --git a/db/migrate/20150112210754_add_banned_to_users.rb b/db/migrate/20150112210754_add_banned_to_users.rb index 7a857608..5c256971 100644 --- a/db/migrate/20150112210754_add_banned_to_users.rb +++ b/db/migrate/20150112210754_add_banned_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddBannedToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :banned, :boolean, default: false diff --git a/db/migrate/20150112210755_create_groups.rb b/db/migrate/20150112210755_create_groups.rb index 9c44ef5c..ba7436e0 100644 --- a/db/migrate/20150112210755_create_groups.rb +++ b/db/migrate/20150112210755_create_groups.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateGroups < ActiveRecord::Migration[4.2] def change create_table :groups do |t| @@ -11,7 +13,7 @@ class CreateGroups < ActiveRecord::Migration[4.2] add_index :groups, :user_id add_index :groups, :name - add_index :groups, [:user_id, :name], unique: true + add_index :groups, %i[user_id name], unique: true create_table :group_members do |t| t.integer :group_id, null: false @@ -22,6 +24,6 @@ class CreateGroups < ActiveRecord::Migration[4.2] add_index :group_members, :group_id add_index :group_members, :user_id - add_index :group_members, [:group_id, :user_id], unique: true + add_index :group_members, %i[group_id user_id], unique: true end end diff --git a/db/migrate/20150125191224_add_blogger_to_users.rb b/db/migrate/20150125191224_add_blogger_to_users.rb index 05edee57..f2a89b12 100644 --- a/db/migrate/20150125191224_add_blogger_to_users.rb +++ b/db/migrate/20150125191224_add_blogger_to_users.rb @@ -1,5 +1,7 @@ +# frozen_string_literal: true + class AddBloggerToUsers < ActiveRecord::Migration[4.2] def change - add_column :users, :blogger, :boolean, default: :false + add_column :users, :blogger, :boolean, default: false end end diff --git a/db/migrate/20150419201122_add_contributor_to_users.rb b/db/migrate/20150419201122_add_contributor_to_users.rb index 91a548aa..72f5488c 100644 --- a/db/migrate/20150419201122_add_contributor_to_users.rb +++ b/db/migrate/20150419201122_add_contributor_to_users.rb @@ -1,5 +1,7 @@ +# frozen_string_literal: true + class AddContributorToUsers < ActiveRecord::Migration[4.2] def change - add_column :users, :contributor, :boolean, default: :false + add_column :users, :contributor, :boolean, default: false end end diff --git a/db/migrate/20150420232305_create_subscriptions.rb b/db/migrate/20150420232305_create_subscriptions.rb index 72061a84..26180ede 100644 --- a/db/migrate/20150420232305_create_subscriptions.rb +++ b/db/migrate/20150420232305_create_subscriptions.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateSubscriptions < ActiveRecord::Migration[4.2] def change create_table :subscriptions do |t| diff --git a/db/migrate/20150421120557_add_is_active_to_subscriptions.rb b/db/migrate/20150421120557_add_is_active_to_subscriptions.rb index 059d4a7b..50372127 100644 --- a/db/migrate/20150421120557_add_is_active_to_subscriptions.rb +++ b/db/migrate/20150421120557_add_is_active_to_subscriptions.rb @@ -1,5 +1,7 @@ +# frozen_string_literal: true + class AddIsActiveToSubscriptions < ActiveRecord::Migration[4.2] def change - add_column :subscriptions, :is_active, :boolean, default: :true + add_column :subscriptions, :is_active, :boolean, default: true end end diff --git a/db/migrate/20150422024104_add_reason_to_report.rb b/db/migrate/20150422024104_add_reason_to_report.rb index 51531b65..e3bef6df 100644 --- a/db/migrate/20150422024104_add_reason_to_report.rb +++ b/db/migrate/20150422024104_add_reason_to_report.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddReasonToReport < ActiveRecord::Migration[4.2] def change add_column :reports, :reason, :string, default: nil diff --git a/db/migrate/20150422224203_rename_banned_to_permanently_banned_in_users.rb b/db/migrate/20150422224203_rename_banned_to_permanently_banned_in_users.rb index 81954d3f..3e74cb2d 100644 --- a/db/migrate/20150422224203_rename_banned_to_permanently_banned_in_users.rb +++ b/db/migrate/20150422224203_rename_banned_to_permanently_banned_in_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class RenameBannedToPermanentlyBannedInUsers < ActiveRecord::Migration[4.2] def up rename_column :users, :banned, :permanently_banned diff --git a/db/migrate/20150422224225_add_ban_reason_and_banned_until_to_users.rb b/db/migrate/20150422224225_add_ban_reason_and_banned_until_to_users.rb index 55936ff8..d312f8ca 100644 --- a/db/migrate/20150422224225_add_ban_reason_and_banned_until_to_users.rb +++ b/db/migrate/20150422224225_add_ban_reason_and_banned_until_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddBanReasonAndBannedUntilToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :ban_reason, :string, default: nil diff --git a/db/migrate/20150504004931_create_comment_smiles.rb b/db/migrate/20150504004931_create_comment_smiles.rb index ea86bca2..064cc1f0 100644 --- a/db/migrate/20150504004931_create_comment_smiles.rb +++ b/db/migrate/20150504004931_create_comment_smiles.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateCommentSmiles < ActiveRecord::Migration[4.2] def change create_table :comment_smiles do |t| @@ -9,7 +11,7 @@ class CreateCommentSmiles < ActiveRecord::Migration[4.2] add_index :comment_smiles, :user_id add_index :comment_smiles, :comment_id - add_index :comment_smiles, [:user_id, :comment_id], unique: true + add_index :comment_smiles, %i[user_id comment_id], unique: true add_column :users, :comment_smiled_count, :integer, default: 0, null: false add_column :comments, :smile_count, :integer, default: 0, null: false diff --git a/db/migrate/20150508144336_add_attachment_profile_header_to_users.rb b/db/migrate/20150508144336_add_attachment_profile_header_to_users.rb index fabf823d..2f704186 100644 --- a/db/migrate/20150508144336_add_attachment_profile_header_to_users.rb +++ b/db/migrate/20150508144336_add_attachment_profile_header_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddAttachmentProfileHeaderToUsers < ActiveRecord::Migration[4.2] def change change_table :users do |t| diff --git a/db/migrate/20150526031159_add_locale_to_user.rb b/db/migrate/20150526031159_add_locale_to_user.rb index 76c828c5..090c66a7 100644 --- a/db/migrate/20150526031159_add_locale_to_user.rb +++ b/db/migrate/20150526031159_add_locale_to_user.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddLocaleToUser < ActiveRecord::Migration[4.2] def change add_column :users, :locale, :string diff --git a/db/migrate/20150619123121_add_translator_to_users.rb b/db/migrate/20150619123121_add_translator_to_users.rb index 8f8da49b..c340278a 100644 --- a/db/migrate/20150619123121_add_translator_to_users.rb +++ b/db/migrate/20150619123121_add_translator_to_users.rb @@ -1,5 +1,7 @@ +# frozen_string_literal: true + class AddTranslatorToUsers < ActiveRecord::Migration[4.2] def change - add_column :users, :translator, :boolean, default: :false + add_column :users, :translator, :boolean, default: false end end diff --git a/db/migrate/20150704072402_change_default_value_of_locale.rb b/db/migrate/20150704072402_change_default_value_of_locale.rb index ed8f0fe8..aa45d331 100644 --- a/db/migrate/20150704072402_change_default_value_of_locale.rb +++ b/db/migrate/20150704072402_change_default_value_of_locale.rb @@ -1,5 +1,7 @@ +# frozen_string_literal: true + class ChangeDefaultValueOfLocale < ActiveRecord::Migration[4.2] def change - change_column :users, :locale, :string, :default => 'en' + change_column :users, :locale, :string, default: "en" end end diff --git a/db/migrate/20150721154255_add_confirmable_to_devise.rb b/db/migrate/20150721154255_add_confirmable_to_devise.rb index fb435503..8167abab 100644 --- a/db/migrate/20150721154255_add_confirmable_to_devise.rb +++ b/db/migrate/20150721154255_add_confirmable_to_devise.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddConfirmableToDevise < ActiveRecord::Migration[4.2] def up add_column :users, :confirmation_token, :string diff --git a/db/migrate/20150825073030_create_themes.rb b/db/migrate/20150825073030_create_themes.rb index ac8da0e8..b556f09e 100644 --- a/db/migrate/20150825073030_create_themes.rb +++ b/db/migrate/20150825073030_create_themes.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateThemes < ActiveRecord::Migration[4.2] def change create_table :themes do |t| @@ -38,6 +40,6 @@ class CreateThemes < ActiveRecord::Migration[4.2] t.timestamps null: false end - add_index :themes, [:user_id, :created_at] + add_index :themes, %i[user_id created_at] end end diff --git a/db/migrate/20150825180139_add_show_foreign_themes_to_users.rb b/db/migrate/20150825180139_add_show_foreign_themes_to_users.rb index 9d00452e..96164b0c 100644 --- a/db/migrate/20150825180139_add_show_foreign_themes_to_users.rb +++ b/db/migrate/20150825180139_add_show_foreign_themes_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddShowForeignThemesToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :show_foreign_themes, :boolean, default: true, null: false diff --git a/db/migrate/20150826224857_add_input_and_outline_to_theme.rb b/db/migrate/20150826224857_add_input_and_outline_to_theme.rb index e4d24e3c..69d3516c 100644 --- a/db/migrate/20150826224857_add_input_and_outline_to_theme.rb +++ b/db/migrate/20150826224857_add_input_and_outline_to_theme.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddInputAndOutlineToTheme < ActiveRecord::Migration[4.2] def change add_column :themes, :input_color, :integer, default: 0xFFFFFF, null: false diff --git a/db/migrate/20160105165913_add_export_fields_to_users.rb b/db/migrate/20160105165913_add_export_fields_to_users.rb index fe4a4fe8..7ffbbbcb 100644 --- a/db/migrate/20160105165913_add_export_fields_to_users.rb +++ b/db/migrate/20160105165913_add_export_fields_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddExportFieldsToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :export_url, :string diff --git a/db/migrate/20200419183714_create_announcements.rb b/db/migrate/20200419183714_create_announcements.rb index 1aedd713..8fe9990c 100644 --- a/db/migrate/20200419183714_create_announcements.rb +++ b/db/migrate/20200419183714_create_announcements.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateAnnouncements < ActiveRecord::Migration[5.2] def change create_table :announcements do |t| diff --git a/db/migrate/20200419185535_create_initial_roles.rb b/db/migrate/20200419185535_create_initial_roles.rb index f3f0788c..0b13b04b 100644 --- a/db/migrate/20200419185535_create_initial_roles.rb +++ b/db/migrate/20200419185535_create_initial_roles.rb @@ -7,11 +7,11 @@ class CreateInitialRoles < ActiveRecord::Migration[5.2] end { - admin: :administrator, - moderator: :moderator + admin: :administrator, + moderator: :moderator, }.each do |legacy_role, new_role| - User.where(legacy_role => true).each do |u| - puts "-- migrating #{u.screen_name} (#{u.id}) from field:#{legacy_role} to role:#{new_role}" + User.where(legacy_role => true).find_each do |u| + Rails.logger.debug { "-- migrating #{u.screen_name} (#{u.id}) from field:#{legacy_role} to role:#{new_role}" } u.add_role new_role u.public_send("#{legacy_role}=", false) u.save! @@ -22,10 +22,10 @@ class CreateInitialRoles < ActiveRecord::Migration[5.2] def down { administrator: :admin, - moderator: :moderator + moderator: :moderator, }.each do |new_role, legacy_role| User.with_role(new_role).each do |u| - puts "-- migrating #{u.screen_name} (#{u.id}) from role:#{new_role} to field:#{legacy_role}" + Rails.logger.debug { "-- migrating #{u.screen_name} (#{u.id}) from role:#{new_role} to field:#{legacy_role}" } u.public_send("#{legacy_role}=", true) u.save! end diff --git a/db/migrate/20200425194536_remove_unused_profile_flags.rb b/db/migrate/20200425194536_remove_unused_profile_flags.rb index 8ce20806..9804b080 100644 --- a/db/migrate/20200425194536_remove_unused_profile_flags.rb +++ b/db/migrate/20200425194536_remove_unused_profile_flags.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class RemoveUnusedProfileFlags < ActiveRecord::Migration[5.2] def change remove_column :users, :admin diff --git a/db/migrate/20200504214933_update_theme_fields.rb b/db/migrate/20200504214933_update_theme_fields.rb index ec577f1d..beda7b69 100644 --- a/db/migrate/20200504214933_update_theme_fields.rb +++ b/db/migrate/20200504214933_update_theme_fields.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class UpdateThemeFields < ActiveRecord::Migration[5.2] def up # CSS file related fields diff --git a/db/migrate/20200517190138_rename_crop_fields.rb b/db/migrate/20200517190138_rename_crop_fields.rb index 12e81325..54781a64 100644 --- a/db/migrate/20200517190138_rename_crop_fields.rb +++ b/db/migrate/20200517190138_rename_crop_fields.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class RenameCropFields < ActiveRecord::Migration[5.2] def change rename_column :users, :crop_h, :profile_picture_h diff --git a/db/migrate/20200517192431_remove_paperclip_fields.rb b/db/migrate/20200517192431_remove_paperclip_fields.rb index 00d4181e..7f4a4d02 100644 --- a/db/migrate/20200517192431_remove_paperclip_fields.rb +++ b/db/migrate/20200517192431_remove_paperclip_fields.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class RemovePaperclipFields < ActiveRecord::Migration[5.2] def change remove_column :users, :profile_picture_content_type diff --git a/db/migrate/20200704163504_use_timestamped_ids.rb b/db/migrate/20200704163504_use_timestamped_ids.rb index 49b44bd7..eaf70732 100644 --- a/db/migrate/20200704163504_use_timestamped_ids.rb +++ b/db/migrate/20200704163504_use_timestamped_ids.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'securerandom' +require "securerandom" # This migration changes the IDs of several tables from serial to a # timestamped/"snowflake" one. @@ -13,7 +13,7 @@ class UseTimestampedIds < ActiveRecord::Migration[5.2] def up # PL/pgSQL is just spicy pascal # don't @ me - execute <<~SQL + execute <<~SQL.squish CREATE or replace FUNCTION gen_timestamp_id(tblname text) RETURNS bigint AS $$ DECLARE timepart bigint; @@ -30,15 +30,15 @@ class UseTimestampedIds < ActiveRecord::Migration[5.2] # we need to migrate related columns to bigints for this to work { - question: %i[answers inboxes], - answer: %i[comments smiles subscriptions], - comment: %i[comment_smiles], - user: %i[announcements answers comment_smiles comments inboxes list_members lists moderation_comments moderation_votes questions reports services smiles subscriptions themes users_roles], + question: %i[answers inboxes], + answer: %i[comments smiles subscriptions], + comment: %i[comment_smiles], + user: %i[announcements answers comment_smiles comments inboxes list_members lists moderation_comments moderation_votes questions reports services smiles subscriptions themes users_roles], # polymorphic tables go brrr recipient: %i[notifications], - source: %i[relationships], - target: %i[notifications relationships reports], + source: %i[relationships], + target: %i[notifications relationships reports], }.each do |ref, tbls| tbls.each do |tbl| say "Migrating #{tbl}.#{ref}_id to bigint" diff --git a/db/migrate/20201001172537_add_otp_secret_key_to_users.rb b/db/migrate/20201001172537_add_otp_secret_key_to_users.rb index 59a33b48..31dc4ed6 100644 --- a/db/migrate/20201001172537_add_otp_secret_key_to_users.rb +++ b/db/migrate/20201001172537_add_otp_secret_key_to_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddOtpSecretKeyToUsers < ActiveRecord::Migration[5.2] def change add_column :users, :otp_secret_key, :string diff --git a/db/migrate/20201101155648_create_totp_recovery_codes.rb b/db/migrate/20201101155648_create_totp_recovery_codes.rb index 3b506256..1d7fac98 100644 --- a/db/migrate/20201101155648_create_totp_recovery_codes.rb +++ b/db/migrate/20201101155648_create_totp_recovery_codes.rb @@ -1,9 +1,11 @@ +# frozen_string_literal: true + class CreateTotpRecoveryCodes < ActiveRecord::Migration[5.2] def change create_table :totp_recovery_codes do |t| t.bigint :user_id t.string :code, limit: 8 end - add_index :totp_recovery_codes, [:user_id, :code] + add_index :totp_recovery_codes, %i[user_id code] end end diff --git a/db/migrate/20210811133004_add_direct_to_questions.rb b/db/migrate/20210811133004_add_direct_to_questions.rb index 092426b9..30632fd6 100644 --- a/db/migrate/20210811133004_add_direct_to_questions.rb +++ b/db/migrate/20210811133004_add_direct_to_questions.rb @@ -5,7 +5,7 @@ class AddDirectToQuestions < ActiveRecord::Migration[5.2] add_column :questions, :direct, :boolean, null: false, default: false # default all legacy questions to direct - execute 'UPDATE questions SET direct = true;' + execute "UPDATE questions SET direct = true;" # All questions where # - the author is not 'justask' (generated questions), and diff --git a/db/migrate/20210814134115_create_user_bans.rb b/db/migrate/20210814134115_create_user_bans.rb index a5146c90..7778d590 100644 --- a/db/migrate/20210814134115_create_user_bans.rb +++ b/db/migrate/20210814134115_create_user_bans.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateUserBans < ActiveRecord::Migration[5.2] def up create_table :user_bans do |t| @@ -15,7 +17,6 @@ class CreateUserBans < ActiveRecord::Migration[5.2] SELECT users.id, users.ban_reason, users.banned_until, users.updated_at, NOW() FROM users WHERE banned_until IS NOT NULL AND NOT permanently_banned;" - execute "INSERT INTO user_bans (user_id, reason, expires_at, created_at, updated_at) SELECT users.id, users.ban_reason, NULL, users.updated_at, NOW() FROM users diff --git a/db/migrate/20211219153054_create_profiles.rb b/db/migrate/20211219153054_create_profiles.rb index d6480af9..933be933 100644 --- a/db/migrate/20211219153054_create_profiles.rb +++ b/db/migrate/20211219153054_create_profiles.rb @@ -1,18 +1,20 @@ +# frozen_string_literal: true + class CreateProfiles < ActiveRecord::Migration[5.2] def change create_table :profiles do |t| t.references :user, index: true, foreign_key: true t.string :display_name, length: 50 - t.string :description, length: 200, null: false, default: '' - t.string :location, length: 72, null: false, default: '' - t.string :website, null: false, default: '' - t.string :motivation_header, null: false, default: '' + t.string :description, length: 200, null: false, default: "" + t.string :location, length: 72, null: false, default: "" + t.string :website, null: false, default: "" + t.string :motivation_header, null: false, default: "" t.timestamps end transaction do - execute 'INSERT INTO profiles (user_id, display_name, description, location, website, motivation_header, created_at, updated_at) SELECT users.id as user_id, users.display_name, users.bio as description, users.location, users.website, users.motivation_header, users.created_at, users.updated_at FROM users;' + execute "INSERT INTO profiles (user_id, display_name, description, location, website, motivation_header, created_at, updated_at) SELECT users.id as user_id, users.display_name, users.bio as description, users.location, users.website, users.motivation_header, users.created_at, users.updated_at FROM users;" remove_column :users, :display_name remove_column :users, :bio diff --git a/db/migrate/20211222165159_create_mute_rules.rb b/db/migrate/20211222165159_create_mute_rules.rb index 0e548bc5..57057fc4 100644 --- a/db/migrate/20211222165159_create_mute_rules.rb +++ b/db/migrate/20211222165159_create_mute_rules.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateMuteRules < ActiveRecord::Migration[5.2] def change create_table :mute_rules do |t| diff --git a/db/migrate/20211228135426_add_indexes_to_notifications.rb b/db/migrate/20211228135426_add_indexes_to_notifications.rb index 15288920..46c9bae9 100644 --- a/db/migrate/20211228135426_add_indexes_to_notifications.rb +++ b/db/migrate/20211228135426_add_indexes_to_notifications.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddIndexesToNotifications < ActiveRecord::Migration[5.2] def change add_index :notifications, :recipient_id diff --git a/db/migrate/20220104180510_add_post_tag_to_services.rb b/db/migrate/20220104180510_add_post_tag_to_services.rb index ab09c201..85789e8e 100644 --- a/db/migrate/20220104180510_add_post_tag_to_services.rb +++ b/db/migrate/20220104180510_add_post_tag_to_services.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddPostTagToServices < ActiveRecord::Migration[5.2] def change add_column :services, :post_tag, :string, limit: 20 diff --git a/db/schema.rb b/db/schema.rb index ea268655..9e2e9bc1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -11,7 +13,6 @@ # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 2023_10_18_172518) do - # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -51,8 +52,8 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do t.datetime "pinned_at" t.index ["created_at"], name: "index_answers_on_created_at", order: :desc t.index ["question_id"], name: "index_answers_on_question_id" - t.index ["user_id", "created_at"], name: "index_answers_on_user_id_and_created_at" - t.index ["user_id", "pinned_at"], name: "index_answers_on_user_id_and_pinned_at" + t.index %w[user_id created_at], name: "index_answers_on_user_id_and_created_at" + t.index %w[user_id pinned_at], name: "index_answers_on_user_id_and_pinned_at" end create_table "appendables", force: :cascade do |t| @@ -63,8 +64,8 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do t.text "content" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false - t.index ["parent_id", "parent_type"], name: "index_appendables_on_parent_id_and_parent_type" - t.index ["user_id", "created_at"], name: "index_appendables_on_user_id_and_created_at" + t.index %w[parent_id parent_type], name: "index_appendables_on_parent_id_and_parent_type" + t.index %w[user_id created_at], name: "index_appendables_on_user_id_and_created_at" end create_table "comments", id: :bigint, default: -> { "gen_timestamp_id('comments'::text)" }, force: :cascade do |t| @@ -75,7 +76,7 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do t.datetime "updated_at" t.integer "smile_count", default: 0, null: false t.index ["answer_id"], name: "index_comments_on_answer_id" - t.index ["user_id", "created_at"], name: "index_comments_on_user_id_and_created_at" + t.index %w[user_id created_at], name: "index_comments_on_user_id_and_created_at" end create_table "inboxes", id: :serial, force: :cascade do |t| @@ -93,7 +94,7 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do t.bigint "user_id", null: false t.datetime "created_at" t.datetime "updated_at" - t.index ["list_id", "user_id"], name: "index_list_members_on_list_id_and_user_id", unique: true + t.index %w[list_id user_id], name: "index_list_members_on_list_id_and_user_id", unique: true end create_table "lists", id: :serial, force: :cascade do |t| @@ -103,7 +104,7 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do t.boolean "private", default: true t.datetime "created_at" t.datetime "updated_at" - t.index ["user_id", "name"], name: "index_lists_on_user_id_and_name", unique: true + t.index %w[user_id name], name: "index_lists_on_user_id_and_name", unique: true end create_table "mute_rules", id: :bigint, default: -> { "gen_timestamp_id('mute_rules'::text)" }, force: :cascade do |t| @@ -150,7 +151,7 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do t.datetime "updated_at" t.integer "answer_count", default: 0, null: false t.boolean "direct", default: false, null: false - t.index ["user_id", "created_at"], name: "index_questions_on_user_id_and_created_at" + t.index %w[user_id created_at], name: "index_questions_on_user_id_and_created_at" end create_table "relationships", id: :serial, force: :cascade do |t| @@ -159,7 +160,7 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do t.datetime "created_at" t.datetime "updated_at" t.string "type", null: false - t.index ["source_id", "target_id", "type"], name: "index_relationships_on_source_id_and_target_id_and_type", unique: true + t.index %w[source_id target_id type], name: "index_relationships_on_source_id_and_target_id_and_type", unique: true t.index ["source_id"], name: "index_relationships_on_source_id" t.index ["target_id"], name: "index_relationships_on_target_id" t.index ["type"], name: "index_relationships_on_type" @@ -173,8 +174,8 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do t.datetime "updated_at" t.boolean "deleted", default: false t.string "reason" - t.index ["type", "target_id"], name: "index_reports_on_type_and_target_id" - t.index ["user_id", "created_at"], name: "index_reports_on_user_id_and_created_at" + t.index %w[type target_id], name: "index_reports_on_type_and_target_id" + t.index %w[user_id created_at], name: "index_reports_on_user_id_and_created_at" end create_table "roles", force: :cascade do |t| @@ -183,8 +184,8 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do t.bigint "resource_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.index ["name", "resource_type", "resource_id"], name: "index_roles_on_name_and_resource_type_and_resource_id" - t.index ["resource_type", "resource_id"], name: "index_roles_on_resource_type_and_resource_id" + t.index %w[name resource_type resource_id], name: "index_roles_on_name_and_resource_type_and_resource_id" + t.index %w[resource_type resource_id], name: "index_roles_on_resource_type_and_resource_id" end create_table "rpush_apps", force: :cascade do |t| @@ -253,7 +254,7 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do t.string "thread_id" t.boolean "dry_run", default: false, null: false t.boolean "sound_is_json", default: false - t.index ["delivered", "failed", "processing", "deliver_after", "created_at"], name: "index_rpush_notifications_multi", where: "((NOT delivered) AND (NOT failed))" + t.index %w[delivered failed processing deliver_after created_at], name: "index_rpush_notifications_multi", where: "((NOT delivered) AND (NOT failed))" end create_table "subscriptions", id: :serial, force: :cascade do |t| @@ -261,7 +262,7 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do t.bigint "answer_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.index ["user_id", "answer_id"], name: "index_subscriptions_on_user_id_and_answer_id" + t.index %w[user_id answer_id], name: "index_subscriptions_on_user_id_and_answer_id" end create_table "themes", id: :serial, force: :cascade do |t| @@ -292,13 +293,13 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do t.integer "input_placeholder", default: 7107965, null: false t.integer "raised_text", default: 0, null: false t.integer "raised_accent_text", default: 0, null: false - t.index ["user_id", "created_at"], name: "index_themes_on_user_id_and_created_at" + t.index %w[user_id created_at], name: "index_themes_on_user_id_and_created_at" end create_table "totp_recovery_codes", force: :cascade do |t| t.bigint "user_id" t.string "code", limit: 8 - t.index ["user_id", "code"], name: "index_totp_recovery_codes_on_user_id_and_code" + t.index %w[user_id code], name: "index_totp_recovery_codes_on_user_id_and_code" end create_table "user_bans", force: :cascade do |t| @@ -375,7 +376,7 @@ ActiveRecord::Schema.define(version: 2023_10_18_172518) do t.bigint "user_id" t.bigint "role_id" t.index ["role_id"], name: "index_users_roles_on_role_id" - t.index ["user_id", "role_id"], name: "index_users_roles_on_user_id_and_role_id" + t.index %w[user_id role_id], name: "index_users_roles_on_user_id_and_role_id" t.index ["user_id"], name: "index_users_roles_on_user_id" end diff --git a/db/seeds.rb b/db/seeds.rb index 9874789c..8136d5c0 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). #