Files
kickkingsapi/schemas/alter_users_rc_bigint.sql
T
2026-06-02 07:48:41 +00:00

9 lines
466 B
SQL

-- `users.rc` as type `real` is IEEE float32: above ~1e7, consecutive values are spaced
-- by more than 1 (and by hundreds at ~4e9), so debits like -20 do not change the stored value.
-- Run this in Supabase SQL before relying on `purchase_rc` or large RC balances.
--
-- After this, re-apply public.purchase_rc from schemas/rpc_purchase_rc.sql (no ::real casts).
alter table public.users
alter column rc type bigint using round(coalesce(rc, 0))::bigint;