Skip to content

Commit ac97fbf

Browse files
tataihonoclaude
andcommitted
refactor: Drop unused columns from sermons table
Remove video_url, content, connect_group_notes, sermon_notes, and snippet — all 100% (or near-100%) null/blank across 652 rows. Updated admin, GraphQL, views, model, and decorator references. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent b2203e1 commit ac97fbf

File tree

8 files changed

+14
-35
lines changed

8 files changed

+14
-35
lines changed

app/admin/sermons.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,11 @@
99
[order_clause.to_sql, 'NULLS LAST'].join(' ')
1010
end
1111

12-
permit_params :name, :snippet, :content, :video, :audio, :youtube_url, :audio_url, :published_at, :featured_at,
13-
:sermon_notes, :connect_group_notes,
12+
permit_params :name, :video, :audio, :youtube_url, :audio_url, :published_at, :featured_at,
1413
topic_ids: [], author_ids: [], scripture_ids: [], series_ids: [],
1514
sermon_scriptures_attributes: %i[id sermon_id scripture_id range _destroy]
1615

1716
filter :name
18-
filter :snippet
19-
filter :content
2017
filter :published_at
2118
filter :featured_at
2219
filter :series, collection: proc { Series.order(:name).all }
@@ -46,8 +43,6 @@
4643
f.input :name
4744
f.input :published_at, as: :date_time_picker
4845
f.input :featured_at, as: :date_time_picker
49-
f.input :snippet
50-
f.input :content, as: :text
5146
f.input :youtube_url
5247
f.input :audio_url
5348
f.input :video, as: :file
@@ -59,8 +54,6 @@
5954
a.input :range
6055
end
6156
f.input :series, collection: Series.all, multiple: true
62-
f.input :sermon_notes, as: :text
63-
f.input :connect_group_notes, as: :text
6457
end
6558
f.actions
6659
end

app/decorators/sermon_decorator.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ def related
4343
end
4444

4545
def description
46-
return snippet if snippet.present?
47-
4846
author_names = authors.map(&:name).join(', ')
4947
scripture_names = sermon_scriptures.map(&:name).join(', ')
5048
display_published_at = published_at.strftime('%b %d, %Y')

app/graphql/types/sermon_type.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,14 @@ class Types::SermonType < Types::BaseObject
77
field :authors, [Types::AuthorType], null: false
88
field :background_url, String, null: true
99
field :banner_url, String, null: true
10-
field :connect_group_notes, String, null: true
1110
field :connection_scriptures, [Types::SermonScriptureType], null: false
12-
field :content, String, null: true
1311
field :foreground_url, String, null: true
1412
field :id, ID, null: false
1513
field :name, String, null: false
1614
field :published_at, GraphQL::Types::ISO8601DateTime, null: true
1715
field :scriptures, [Types::ScriptureType], null: false
1816
field :series, [Types::SeriesType], null: false
19-
field :sermon_notes, String, null: true
20-
field :snippet, String, null: true
2117
field :topics, [Types::TopicType], null: false
22-
field :video_url, String, null: true
2318
field :youtube_url, String, null: true
2419

2520
def banner_url
@@ -41,10 +36,6 @@ def audio_url
4136
object.audio_url.presence || (object.audio.attached? ? polymorphic_url(object.audio) : nil)
4237
end
4338

44-
def video_url
45-
object.video_url.presence || (object.video.attached? ? polymorphic_url(object.video) : nil)
46-
end
47-
4839
protected
4940

5041
def attached_image(name)

app/models/sermon.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ def self.ransackable_associations(_auth_object = nil)
4141
end
4242

4343
def self.ransackable_attributes(_auth_object = nil)
44-
%w[created_at featured_at id name published_at slug updated_at snippet content]
44+
%w[created_at featured_at id name published_at slug updated_at]
4545
end
4646
end

app/views/resources/show.html.erb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<% end %>
1414
</div>
1515
<h1><%= title resource.name %></h1>
16-
<p class="lead"><%= resource.snippet %></p>
16+
<p class="lead"><%= resource.description %></p>
1717
<div class="addthis_inline_share_toolbox mb-3"></div>
1818
<p>
1919
<% if resource.authors.any? %>
@@ -46,13 +46,6 @@
4646
<% end %>
4747
<% end %>
4848
</div>
49-
<% if resource.content.present? %>
50-
<div class="container pb-5">
51-
<div class="resource-content">
52-
<%= resource.content.html_safe %>
53-
</div>
54-
</div>
55-
<% end %>
5649
</div>
5750
<% if resource.related.any? %>
5851
<div class="card-deck-container">

app/views/shared/resource/_card.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<%= link_to author.name, author_path(author) %>
1414
<% end %>
1515
</div>
16-
<p class="card-text"><%= resource.snippet %></p>
16+
<p class="card-text"><%= resource.description %></p>
1717
</div>
1818
<div class="card-footer border-top d-flex">
1919
<date class="date"><%= resource.published_at.strftime('%b %d, %Y') %></date>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class RemoveUnusedColumnsFromSermons < ActiveRecord::Migration[7.2]
2+
def change
3+
remove_column :sermons, :video_url, :string
4+
remove_column :sermons, :content, :text
5+
remove_column :sermons, :connect_group_notes, :text
6+
remove_column :sermons, :sermon_notes, :text
7+
remove_column :sermons, :snippet, :string
8+
end
9+
end

db/schema.rb

Lines changed: 1 addition & 6 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[7.2].define(version: 2026_03_28_000000) do
13+
ActiveRecord::Schema[7.2].define(version: 2026_03_28_102619) do
1414
# These are extensions that must be enabled in order to support this database
1515
enable_extension "pg_stat_statements"
1616
enable_extension "pgcrypto"
@@ -159,19 +159,14 @@
159159

160160
create_table "sermons", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t|
161161
t.string "name"
162-
t.string "snippet"
163-
t.text "content"
164162
t.datetime "published_at", precision: nil
165163
t.datetime "featured_at", precision: nil
166-
t.string "video_url"
167164
t.string "slug"
168165
t.datetime "created_at", null: false
169166
t.datetime "updated_at", null: false
170167
t.string "youtube_url"
171168
t.string "remote_id"
172169
t.string "audio_url"
173-
t.text "sermon_notes"
174-
t.text "connect_group_notes"
175170
end
176171

177172
create_table "users", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t|

0 commit comments

Comments
 (0)