Fix Rails/CreateTableWithTimestamps cop (#30836)

This commit is contained in:
Matt Jankowski 2024-10-01 09:56:43 -04:00 committed by GitHub
parent 65508bb0c0
commit 4cae309f6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 13 additions and 8 deletions

View file

@ -2,3 +2,8 @@ inherit_from: ../../.rubocop.yml
Naming/VariableNumber: Naming/VariableNumber:
CheckSymbols: false CheckSymbols: false
# Enabled here as workaround for https://docs.rubocop.org/rubocop/configuration.html#path-relativity
Rails/CreateTableWithTimestamps:
Include:
- '*.rb'

View file

@ -2,7 +2,7 @@
class CreateConversationMutes < ActiveRecord::Migration[5.0] class CreateConversationMutes < ActiveRecord::Migration[5.0]
def change def change
create_table :conversation_mutes do |t| create_table :conversation_mutes do |t| # rubocop:disable Rails/CreateTableWithTimestamps
t.integer :account_id, null: false t.integer :account_id, null: false
t.bigint :conversation_id, null: false t.bigint :conversation_id, null: false
end end

View file

@ -2,7 +2,7 @@
class CreateStatusPins < ActiveRecord::Migration[5.1] class CreateStatusPins < ActiveRecord::Migration[5.1]
def change def change
create_table :status_pins do |t| create_table :status_pins do |t| # rubocop:disable Rails/CreateTableWithTimestamps
t.belongs_to :account, foreign_key: { on_delete: :cascade }, null: false t.belongs_to :account, foreign_key: { on_delete: :cascade }, null: false
t.belongs_to :status, foreign_key: { on_delete: :cascade }, null: false t.belongs_to :status, foreign_key: { on_delete: :cascade }, null: false
end end

View file

@ -2,7 +2,7 @@
class CreateListAccounts < ActiveRecord::Migration[5.2] class CreateListAccounts < ActiveRecord::Migration[5.2]
def change def change
create_table :list_accounts do |t| create_table :list_accounts do |t| # rubocop:disable Rails/CreateTableWithTimestamps
t.belongs_to :list, foreign_key: { on_delete: :cascade }, null: false t.belongs_to :list, foreign_key: { on_delete: :cascade }, null: false
t.belongs_to :account, foreign_key: { on_delete: :cascade }, null: false t.belongs_to :account, foreign_key: { on_delete: :cascade }, null: false
t.belongs_to :follow, foreign_key: { on_delete: :cascade }, null: false t.belongs_to :follow, foreign_key: { on_delete: :cascade }, null: false

View file

@ -2,7 +2,7 @@
class CreateAccountConversations < ActiveRecord::Migration[5.2] class CreateAccountConversations < ActiveRecord::Migration[5.2]
def change def change
create_table :account_conversations do |t| create_table :account_conversations do |t| # rubocop:disable Rails/CreateTableWithTimestamps
t.belongs_to :account, foreign_key: { on_delete: :cascade } t.belongs_to :account, foreign_key: { on_delete: :cascade }
t.belongs_to :conversation, foreign_key: { on_delete: :cascade } t.belongs_to :conversation, foreign_key: { on_delete: :cascade }
t.bigint :participant_account_ids, array: true, null: false, default: [] t.bigint :participant_account_ids, array: true, null: false, default: []

View file

@ -2,7 +2,7 @@
class CreatePgheroSpaceStats < ActiveRecord::Migration[5.2] class CreatePgheroSpaceStats < ActiveRecord::Migration[5.2]
def change def change
create_table :pghero_space_stats do |t| create_table :pghero_space_stats do |t| # rubocop:disable Rails/CreateTableWithTimestamps
t.text :database t.text :database
t.text :schema t.text :schema
t.text :relation t.text :relation

View file

@ -2,7 +2,7 @@
class CreateScheduledStatuses < ActiveRecord::Migration[5.2] class CreateScheduledStatuses < ActiveRecord::Migration[5.2]
def change def change
create_table :scheduled_statuses do |t| create_table :scheduled_statuses do |t| # rubocop:disable Rails/CreateTableWithTimestamps
t.belongs_to :account, foreign_key: { on_delete: :cascade } t.belongs_to :account, foreign_key: { on_delete: :cascade }
t.datetime :scheduled_at, index: true t.datetime :scheduled_at, index: true
t.jsonb :params t.jsonb :params

View file

@ -2,7 +2,7 @@
class CreateStatusTrends < ActiveRecord::Migration[6.1] class CreateStatusTrends < ActiveRecord::Migration[6.1]
def change def change
create_table :status_trends do |t| create_table :status_trends do |t| # rubocop:disable Rails/CreateTableWithTimestamps
t.references :status, null: false, foreign_key: { on_delete: :cascade }, index: { unique: true } t.references :status, null: false, foreign_key: { on_delete: :cascade }, index: { unique: true }
t.references :account, null: false, foreign_key: { on_delete: :cascade } t.references :account, null: false, foreign_key: { on_delete: :cascade }
t.float :score, null: false, default: 0 t.float :score, null: false, default: 0

View file

@ -2,7 +2,7 @@
class CreatePreviewCardTrends < ActiveRecord::Migration[6.1] class CreatePreviewCardTrends < ActiveRecord::Migration[6.1]
def change def change
create_table :preview_card_trends do |t| create_table :preview_card_trends do |t| # rubocop:disable Rails/CreateTableWithTimestamps
t.references :preview_card, null: false, foreign_key: { on_delete: :cascade }, index: { unique: true } t.references :preview_card, null: false, foreign_key: { on_delete: :cascade }, index: { unique: true }
t.float :score, null: false, default: 0 t.float :score, null: false, default: 0
t.integer :rank, null: false, default: 0 t.integer :rank, null: false, default: 0