#delete from release_accounting where period_id = 245 ## just start with an empty RA table ## empty out release_accounting SET @period := 246; SET @lastPeriod := @period - 1; SET @rename := CONCAT('ALTER TABLE release_accounting RENAME ',(CONCAT_WS('_','release_accounting',DATE_FORMAT(NOW(),"%Y%m%d_%H%i%s")))); PREPARE stmt FROM @rename; EXECUTE stmt; DEALLOCATE PREPARE stmt; CREATE TABLE `release_accounting` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `upc` bigint(20) NOT NULL, `year` smallint(6) NOT NULL, `quarter` tinyint(4) NOT NULL, `amount` decimal(18,6) NOT NULL, `entry_type` varchar(30) NOT NULL, `period_id` tinyint(3) unsigned DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `unique_constraint` (`entry_type`,`upc`,`period_id`), KEY `period_id` (`period_id`), KEY `upc` (`upc`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DELETE FROM vendor_accounting WHERE period_id = @period; DELETE FROM vendor_payment_interval_history WHERE period_id = @period; DELETE FROM vendor_accounting WHERE period_id = @lastPeriod AND entry_type IN ( 'advance_recouped', 'dig_outstanding_balance', 'digital_checkspaid', 'label_outstanding_balance', 'man_adj_outstanding_balance', 'manual_adjustment', 'manual_adjustment_checkspaid', 'outstanding_balance', 'phy_outstanding_balance', 'physical_checkspaid', 'total_checkspaid' ); docker-compose -f ./oa_docker/docker-compose.yml down docker-compose -f ./oa_docker/docker-compose.yml up -d docker exec -it ac_old_app sh run composer install ## mock run php scripts/Accounting/publishAccountingQueue.php -y 2019 -m 5 -b 1 php scripts/Accounting/processSummaryQueue.php -y 2019 -m 5 ## 15906 28603 INSERT INTO `payment_calculator_status` (`pid`, `progress`, `is_canceled`, `params`, `vendors_total`, `time_started`) VALUES (99999, 0, 0, '{\"remove_old_data\":\"on\",\"bypass_recurring_payment_threshold\":\"on\",\"vendor_id\":15906}', 1, NOW()); TRUNCATE payment_calculator_status; TRUNCATE payment_calculator_vendor; TRUNCATE checkspaid_tmp; TRUNCATE vendor_checkspaid_tmp; TRUNCATE vendor_accounting_flat; ## mock payout php scripts/Accounting/payment_calculator_cron.php -D