Update indexs and speed up partner page

This commit is contained in:
Seth Call 2025-03-23 15:05:41 -05:00 committed by Nuwan
parent b2c2129d42
commit 49888b9b5b
2 changed files with 11 additions and 2 deletions

View File

@ -6,13 +6,13 @@ ActiveAdmin.register JamRuby::AffiliatePartner, :as => 'Affiliates' do
config.batch_actions = false
# config.clear_action_items!
config.filters = true
config.per_page = 50
config.per_page = 100
config.paginate = true
#form :partial => 'form'
filter :partner_user
#filter :partner_user
filter :partner_name
filter :id

View File

@ -22,6 +22,11 @@ class AddTrackingTotalsToAffiliatePartners < ActiveRecord::Migration
execute "ALTER TABLE affiliate_quarterly_payments ADD COLUMN subscription_due_amount_in_cents INTEGER NOT NULL DEFAULT 0"
execute "ALTER TABLE affiliate_monthly_payments ADD COLUMN jamtrack_due_amount_in_cents INTEGER NOT NULL DEFAULT 0"
execute "ALTER TABLE affiliate_monthly_payments ADD COLUMN subscription_due_amount_in_cents INTEGER NOT NULL DEFAULT 0"
execute "CREATE INDEX affiliate_partner_user_id_idx ON affiliate_partners USING btree (partner_user_id);"
execute "CREATE INDEX affiliate_quarterly_payments_closed_index ON affiliate_quarterly_payments USING btree (paid);"
execute "CREATE INDEX affiliate_quarterly_payments_paid_index ON affiliate_quarterly_payments USING btree (closed);"
execute "CREATE INDEX affiliate_monthly_payments_paid_index ON affiliate_monthly_payments USING btree (closed);"
end
=begin
@ -38,6 +43,10 @@ class AddTrackingTotalsToAffiliatePartners < ActiveRecord::Migration
ALTER TABLE affiliate_monthly_payments ADD COLUMN subscription_due_amount_in_cents INTEGER NOT NULL DEFAULT 0;
ALTER TABLE affiliate_quarterly_payments ADD COLUMN subscriptions_count INTEGER NOT NULL DEFAULT 0;
ALTER TABLE affiliate_monthly_payments ADD COLUMN subscriptions_count INTEGER NOT NULL DEFAULT 0;
CREATE INDEX affiliate_partner_user_id_idx ON affiliate_partners USING btree (partner_user_id);
CREATE INDEX affiliate_quarterly_payments_closed_index ON affiliate_quarterly_payments USING btree (paid);
CREATE INDEX affiliate_quarterly_payments_paid_index ON affiliate_quarterly_payments USING btree (closed);
CREATE INDEX affiliate_monthly_payments_paid_index ON affiliate_monthly_payments USING btree (closed);
=end