-- Adiciona campo chart_of_account_id nas tabelas payables e receivables
-- Execute este script no banco de dados

ALTER TABLE payables 
ADD COLUMN chart_of_account_id INT NULL COMMENT 'ID da classificação no plano de contas' 
AFTER account_id,
ADD INDEX idx_chart_of_account (chart_of_account_id),
ADD FOREIGN KEY (chart_of_account_id) REFERENCES chart_of_accounts(id) ON DELETE SET NULL;

ALTER TABLE receivables 
ADD COLUMN chart_of_account_id INT NULL COMMENT 'ID da classificação no plano de contas' 
AFTER account_id,
ADD INDEX idx_chart_of_account (chart_of_account_id),
ADD FOREIGN KEY (chart_of_account_id) REFERENCES chart_of_accounts(id) ON DELETE SET NULL;

