Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions db/migrate/20251221104708_change_audits_id_to_bigint.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class ChangeAuditsIdToBigint < ActiveRecord::Migration[7.1]
uses_departure! if Rails.env.staging? || Rails.env.production?

def up
change_column :audits, :id, "bigint NOT NULL AUTO_INCREMENT"
end

def down
raise ActiveRecord::IrreversibleMigration, "This migration cannot be reverted because we can't safely migrate to a smaller id"
end
end
11 changes: 11 additions & 0 deletions spec/models/user_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
require "spec_helper"

describe User do
describe "audits" do
let(:user) { create(:user) }

it "can have an id larger than unsigned int" do
audit = Audited::Audit.new(id: 5_294_967_295, auditable: user)

expect(audit).to be_valid
expect(audit.save).to be_truthy
end
end

describe "validations" do
context "with a forbidden user name" do
let(:forbidden_username) { Faker::Lorem.characters(number: 8) }
Expand Down
Loading