From ab3c8f67251122796f336c128cc9f99b71d89f9c Mon Sep 17 00:00:00 2001 From: Alyssa Powell Date: Thu, 2 Oct 2025 10:47:35 -0700 Subject: [PATCH] AO3-7045: Migrate audits table to BIGINT Change audits.id from integer to bigint to prevent integer overflow as the audit log grows. This follows the established pattern for similar migrations in the codebase. --- .../20251002104708_change_audits_id_to_bigint.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 db/migrate/20251002104708_change_audits_id_to_bigint.rb diff --git a/db/migrate/20251002104708_change_audits_id_to_bigint.rb b/db/migrate/20251002104708_change_audits_id_to_bigint.rb new file mode 100644 index 00000000000..e65bc1c6d8d --- /dev/null +++ b/db/migrate/20251002104708_change_audits_id_to_bigint.rb @@ -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 \ No newline at end of file