Monday, March 7, 2016¶
I continued to work on on data import (cpas2lino
) for
#147.
When running cpas2lino
a second time on the same database,
it can take a considerable time to delete the vouchers generated by
the previous run. Here is how I can save that time.
I create a delete_ledger.sql
with this content (a manual
selection from the output of sqlflush
):
BEGIN;
DELETE FROM "ledger_voucher";
DELETE FROM "vatless_accountinvoice";
DELETE FROM "finan_bankstatement";
DELETE FROM "finan_journalentryitem";
DELETE FROM "finan_bankstatementitem";
DELETE FROM "ledger_movement";
DELETE FROM "vatless_invoiceitem";
DELETE FROM "finan_paymentorder";
DELETE FROM "finan_journalentry";
DELETE FROM "finan_paymentorderitem";
COMMIT;
Note that the output of sqlflush
depends on the database
engine. For MySQL it is different than for SQLite.
And then I run the following command before doing cpas2lino
:
$ cat delete_ledger.sql | python manage.py dbshell