Skip to content

Commit

Permalink
Remove tracks.waveform_data
Browse files Browse the repository at this point in the history
  • Loading branch information
jcraigk committed Oct 19, 2023
1 parent 989a33a commit 2de8328
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion app/services/waveform_image_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def call
extract_waveform_data
generate_waveform_image
track.update!(
waveform_data: data,
waveform_max: data.max,
waveform_image: File.open(tmp_image)
)
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20231019051213_remove_waveform_data_from_tracks.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RemoveWaveformDataFromTracks < ActiveRecord::Migration[7.1]
def change
remove_column :tracks, :waveform_data, :jsonb
end
end
3 changes: 1 addition & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2022_12_24_070950) do
ActiveRecord::Schema[7.1].define(version: 2023_10_19_051213) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

Expand Down Expand Up @@ -201,7 +201,6 @@
t.integer "jam_starts_at_second"
t.text "audio_file_data"
t.text "waveform_image_data"
t.json "waveform_data"
t.float "waveform_max"
t.index ["jam_starts_at_second"], name: "index_tracks_on_jam_starts_at_second"
t.index ["likes_count"], name: "index_tracks_on_likes_count"
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/tracks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace :tracks do

desc 'Generate waveform images from audio files'
task generate_images: :environment do
relation = Track.includes(:show).where(waveform_data: nil).order(id: :desc)
relation = Track.includes(:show).where(waveform_max: nil).order(id: :desc)
pbar = ProgressBar.create(
total: relation.count,
format: '%a %B %c/%C %p%% %E'
Expand Down

0 comments on commit 2de8328

Please sign in to comment.