From 6934734292a3ba477c229c2d847e23596e856303 Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Mon, 12 Oct 2026 18:58:08 +0200 Subject: [PATCH] chore(members): drop the dead unsubscribed column Step 2 of #3007. The members.unsubscribed boolean has been dead since 2014 and is now removed from the schema, with the absence pinned in the member spec. The column held 84 true values from 2013-2014 unsubscribe clicks; per #3007 the drop changes no subscription state. Merge only after the ignored_columns change has deployed: old releases name the column in their member SELECT list, built from the schema cache at boot, and dropping it while they still serve would fail every member query during the Heroku preboot switch. --- .../20261012090000_remove_unsubscribed_from_members.rb | 5 +++++ db/schema.rb | 3 +-- spec/models/member_spec.rb | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20261012090000_remove_unsubscribed_from_members.rb diff --git a/db/migrate/20261012090000_remove_unsubscribed_from_members.rb b/db/migrate/20261012090000_remove_unsubscribed_from_members.rb new file mode 100644 index 000000000..347aec653 --- /dev/null +++ b/db/migrate/20261012090000_remove_unsubscribed_from_members.rb @@ -0,0 +1,5 @@ +class RemoveUnsubscribedFromMembers < ActiveRecord::Migration[8.1] + def change + safety_assured { remove_column :members, :unsubscribed, :boolean } + end +end diff --git a/db/schema.rb b/db/schema.rb index 7410ca203..0aaeadeca 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.1].define(version: 2026_09_24_090000) do +ActiveRecord::Schema[8.1].define(version: 2026_10_12_090000) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" @@ -462,7 +462,6 @@ t.boolean "received_coach_welcome_email", default: false t.boolean "received_student_welcome_email", default: false t.string "surname" - t.boolean "unsubscribed" t.datetime "updated_at", precision: nil t.index ["email"], name: "index_members_on_email", unique: true end diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb index 6a4d6b64f..b6eac4209 100644 --- a/spec/models/member_spec.rb +++ b/spec/models/member_spec.rb @@ -326,5 +326,9 @@ it 'does not expose the legacy unsubscribed attribute' do expect(described_class.new).not_to respond_to(:unsubscribed) end + + it 'has dropped the legacy unsubscribed column from the database' do + expect(ActiveRecord::Base.connection.column_exists?(:members, :unsubscribed)).to be(false) + end end end