Skip to content

Commit b4a160c

Browse files
committed
refactor: is_activeカラムの削除とテスト修正
実装内容: - マイグレーションでis_activeカラムを削除 - is_active関連のテストを削除(不要になったため) - すべてのRSpecテストが成功 結果: - データの一貫性: inactivated_atカラムのみで管理 - コードの簡潔性: 重複したロジックを完全に削除 - 既存機能: すべて正常動作を確認 Closes #1734
1 parent 37d6f87 commit b4a160c

File tree

3 files changed

+9
-19
lines changed

3 files changed

+9
-19
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class RemoveIsActiveFromDojos < ActiveRecord::Migration[8.0]
2+
def change
3+
# is_active カラムを削除
4+
# このカラムは inactivated_at カラムと重複していたため削除
5+
# Issue #1734: https://github.com/coderdojo-japan/coderdojo.jp/issues/1734
6+
remove_column :dojos, :is_active, :boolean
7+
end
8+
end

db/schema.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[8.0].define(version: 2025_08_05_105233) do
13+
ActiveRecord::Schema[8.0].define(version: 2025_08_14_115324) do
1414
# These are extensions that must be enabled in order to support this database
1515
enable_extension "pg_catalog.plpgsql"
1616
enable_extension "pg_stat_statements"
@@ -36,7 +36,6 @@
3636
t.datetime "created_at", precision: nil, null: false
3737
t.datetime "updated_at", precision: nil, null: false
3838
t.integer "prefecture_id"
39-
t.boolean "is_active", default: true, null: false
4039
t.boolean "is_private", default: false, null: false
4140
t.integer "counter", default: 1, null: false
4241
t.text "note", default: "", null: false

spec/models/dojo_spec.rb

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
it { should respond_to(:tags) }
2222

2323
it { should be_valid }
24-
it { expect(Dojo.new.is_active?).to be(true) }
2524

2625
describe "when name is not present" do
2726
before { @dojo.name = " " }
@@ -167,22 +166,6 @@
167166
)
168167
end
169168

170-
describe '#sync_active_status' do
171-
it 'sets inactivated_at when is_active becomes false' do
172-
expect(@dojo.inactivated_at).to be_nil
173-
@dojo.update!(is_active: false)
174-
expect(@dojo.inactivated_at).to be_present
175-
end
176-
177-
it 'clears inactivated_at when is_active becomes true' do
178-
@dojo.update!(is_active: false)
179-
expect(@dojo.inactivated_at).to be_present
180-
181-
@dojo.update!(is_active: true)
182-
expect(@dojo.inactivated_at).to be_nil
183-
end
184-
end
185-
186169
describe '#active?' do
187170
it 'returns true when inactivated_at is nil' do
188171
@dojo.inactivated_at = nil

0 commit comments

Comments
 (0)