-- One-off migration: adds a category column to the expenses table so each
-- manual expense entry (Финансы → Прочие расходы) can be tagged with one of
-- a fixed set of categories (see Expense::CATEGORIES).
--
-- IMPORTANT: this file contains Cyrillic text — force the client to
-- utf8mb4, otherwise the mysql CLI's default charset (often latin1) will
-- double-encode it into mojibake:
--
--   docker compose exec -T db mysql --default-character-set=utf8mb4 \
--       -u"$(grep '^DB_USER=' .env | cut -d '=' -f2-)" \
--       -p"$(grep '^DB_PASS=' .env | cut -d '=' -f2-)" \
--       "$(grep '^DB_NAME=' .env | cut -d '=' -f2-)" \
--       < scripts/add_category_to_expenses.sql
--
-- MySQL doesn't support IF NOT EXISTS on ADD COLUMN — safe to run once;
-- re-running will error with "Duplicate column name", which is harmless.

ALTER TABLE expenses ADD COLUMN category VARCHAR(50) NULL AFTER title;
