-- Phase 10.3: link banks with receipts and payments
ALTER TABLE customer_receipts ADD COLUMN IF NOT EXISTS bank_account_id INT NULL AFTER cashbox_id;
ALTER TABLE customer_receipts ADD COLUMN IF NOT EXISTS account_source_type VARCHAR(20) NOT NULL DEFAULT 'cashbox' AFTER bank_account_id;

ALTER TABLE cash_payments MODIFY cashbox_id BIGINT UNSIGNED NULL;
ALTER TABLE cash_payments ADD COLUMN IF NOT EXISTS bank_account_id INT NULL AFTER cashbox_id;
ALTER TABLE cash_payments ADD COLUMN IF NOT EXISTS account_source_type VARCHAR(20) NOT NULL DEFAULT 'cashbox' AFTER bank_account_id;
