1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-10 21:24:20 +01:00
fab-manager/db/migrate/20200511075933_fix_accounting_periods.rb

18 lines
666 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2021-05-24 11:38:25 +02:00
require 'integrity/archive_helper'
# regenerate the accounting periods affected by the current bug (period totals are wrong due to wrong VAT computation)
class FixAccountingPeriods < ActiveRecord::Migration[5.2]
def change
# first, check the footprints
2021-05-24 11:38:25 +02:00
Integrity::ArchiveHelper.check_footprints
# if everything is ok, proceed with migration
# remove periods (backup their parameters in memory)
2021-05-24 11:38:25 +02:00
periods = Integrity::ArchiveHelper.backup_and_remove_periods(range_start: '2019-08-01', range_end: '2020-05-12')
# recreate periods from memory dump
2021-05-24 11:38:25 +02:00
Integrity::ArchiveHelper.restore_periods(periods)
end
end