Skip to content

Commit

Permalink
Merge branch 'main' into add-solr-search-engine
Browse files Browse the repository at this point in the history
  • Loading branch information
BlazingRockStorm committed Oct 16, 2023
2 parents a126b45 + d242136 commit ef2ed50
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
14 changes: 14 additions & 0 deletions app/jobs/reset_database_sequence_job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

class ResetDatabaseSequenceJob < ApplicationJob
queue_as :low

def perform(*_args)
# Do something later
# sau import, chạy rails c và reset seq:

%w[users songs artists artists_songs genres albums].each do |tablename|
ActiveRecord::Base.connection.reset_pk_sequence!(tablename)
end
end
end
5 changes: 4 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
get '/about', to: 'home#about', as: 'about'
get '/', to: 'home#index', as: 'home'

mount Sidekiq::Web, at: '/sidekiq'
authenticate :user do
mount Sidekiq::Web, at: '/sidekiq'
end

match '*unmatched', to: 'application#not_found', via: :all
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end
7 changes: 7 additions & 0 deletions spec/jobs/reset_database_sequence_job_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe ResetDatabaseSequenceJob do
pending "add some examples to (or delete) #{__FILE__}"
end

0 comments on commit ef2ed50

Please sign in to comment.