-- Deploy kakeibo:transactions to pg
-- requires: schema
-- requires: articles

BEGIN;

ALTER TABLE kakeibo.transactions RENAME COLUMN type TO type_code;
ALTER TABLE kakeibo.transactions
  ALTER COLUMN type_code TYPE integer
  USING CASE type_code WHEN 'outgo' THEN 0 ELSE 1 END;

COMMIT;
