-- ============================
-- EXPENSES
-- ============================
ALTER TABLE expenses DROP COLUMN IF EXISTS grand_total;

ALTER TABLE expenses RENAME COLUMN note TO notes;

ALTER TABLE expenses RENAME COLUMN expense_date TO transaction_date;

-- ============================
-- EXPENSE_REALIZATIONS
-- ============================
ALTER TABLE expense_realizations
RENAME COLUMN realization_qty TO qty;

ALTER TABLE expense_realizations
RENAME COLUMN realization_unit_price TO price;

ALTER TABLE expense_realizations RENAME COLUMN note TO notes;

ALTER TABLE expense_realizations
DROP COLUMN IF EXISTS realization_total_price;

ALTER TABLE expense_realizations
DROP COLUMN IF EXISTS realization_date;

ALTER TABLE expense_realizations DROP COLUMN IF EXISTS created_by;

ALTER TABLE expense_realizations
ADD COLUMN IF NOT EXISTS created_at TIMESTAMPTZ DEFAULT NOW();

-- ============================
-- EXPENSE_NONSTOCKS
-- ============================
ALTER TABLE expense_nonstocks RENAME COLUMN note TO notes;

ALTER TABLE expense_nonstocks DROP COLUMN IF EXISTS total_price;

ALTER TABLE expense_nonstocks RENAME COLUMN unit_price TO price;

ALTER TABLE expense_nonstocks DROP COLUMN IF EXISTS created_by;

ALTER TABLE expense_nonstocks
ADD COLUMN IF NOT EXISTS created_at TIMESTAMPTZ DEFAULT NOW();