ALTER TABLE public.count_invoices ALTER COLUMN invoice_total TYPE numeric(12, 2) USING invoice_total::numeric;
ALTER TABLE public.count_invoices ALTER COLUMN invoice_vat TYPE numeric(12, 2) USING invoice_vat::numeric;

ALTER TABLE public.count_invoices_rows DROP COLUMN row_total_vat;
ALTER TABLE public.count_invoices_rows DROP COLUMN row_total;
ALTER TABLE public.count_invoices_rows ALTER COLUMN unit_price TYPE numeric(12, 2) USING unit_price::numeric;
ALTER TABLE public.count_invoices_rows ADD COLUMN row_total numeric(12, 2) NOT NULL GENERATED ALWAYS AS (quantity * unit_price) stored;
ALTER TABLE public.count_invoices_rows ADD COLUMN row_total_vat numeric(12, 2) NOT NULL GENERATED ALWAYS AS ((quantity * unit_price) + (((quantity * unit_price) / 100) * row_vat)) stored;
