Skip to content

Commit

Permalink
Fix Rails/CreateTableWithTimestamps cop (mastodon#30836)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjankowski authored Oct 1, 2024
1 parent 65508bb commit 4cae309
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions db/migrate/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ inherit_from: ../../.rubocop.yml

Naming/VariableNumber:
CheckSymbols: false

# Enabled here as workaround for https://docs.rubocop.org/rubocop/configuration.html#path-relativity
Rails/CreateTableWithTimestamps:
Include:
- '*.rb'
2 changes: 1 addition & 1 deletion db/migrate/20170508230434_create_conversation_mutes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class CreateConversationMutes < ActiveRecord::Migration[5.0]
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.bigint :conversation_id, null: false
end
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20170823162448_create_status_pins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class CreateStatusPins < ActiveRecord::Migration[5.1]
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 :status, foreign_key: { on_delete: :cascade }, null: false
end
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20171116161857_create_list_accounts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class CreateListAccounts < ActiveRecord::Migration[5.2]
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 :account, foreign_key: { on_delete: :cascade }, null: false
t.belongs_to :follow, foreign_key: { on_delete: :cascade }, null: false
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20180929222014_create_account_conversations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class CreateAccountConversations < ActiveRecord::Migration[5.2]
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 :conversation, foreign_key: { on_delete: :cascade }
t.bigint :participant_account_ids, array: true, null: false, default: []
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20181007025445_create_pghero_space_stats.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class CreatePgheroSpaceStats < ActiveRecord::Migration[5.2]
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 :schema
t.text :relation
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20190103124649_create_scheduled_statuses.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class CreateScheduledStatuses < ActiveRecord::Migration[5.2]
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.datetime :scheduled_at, index: true
t.jsonb :params
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20220824233535_create_status_trends.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class CreateStatusTrends < ActiveRecord::Migration[6.1]
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 :account, null: false, foreign_key: { on_delete: :cascade }
t.float :score, null: false, default: 0
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20221006061337_create_preview_card_trends.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class CreatePreviewCardTrends < ActiveRecord::Migration[6.1]
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.float :score, null: false, default: 0
t.integer :rank, null: false, default: 0
Expand Down

0 comments on commit 4cae309

Please sign in to comment.