Skip to content

Commit

Permalink
DEV: Fix mismatched column types (#317)
Browse files Browse the repository at this point in the history
The primary key is usually a bigint column, but the foreign key columns
are usually of integer type. This can lead to issues when joining these
columns due to mismatched types and different value ranges.

This was using a temporary plugin / test API to make tests pass, but it
is safe to alter these tables because they usually have less than 1M
rows.
  • Loading branch information
nbianca authored Oct 28, 2024
1 parent 87f2192 commit 4c70d3a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
11 changes: 11 additions & 0 deletions db/migrate/20241025133536_alter_reaction_ids_to_bigint.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

class AlterReactionIdsToBigint < ActiveRecord::Migration[7.1]
def up
change_column :discourse_reactions_reaction_users, :reaction_id, :bigint
end

def down
raise ActiveRecord::IrreversibleMigration
end
end
9 changes: 0 additions & 9 deletions spec/plugin_helper.rb

This file was deleted.

0 comments on commit 4c70d3a

Please sign in to comment.