Files
junhong_cmp_fiber/migrations/archive/000098_backfill_asset_wallets.down.sql

9 lines
302 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 回滚删除补建的空钱包仅删除余额为0且无交易记录的钱包
DELETE FROM tb_asset_wallet
WHERE balance = 0
AND frozen_balance = 0
AND deleted_at IS NULL
AND id NOT IN (
SELECT DISTINCT asset_wallet_id FROM tb_asset_wallet_transaction WHERE deleted_at IS NULL
);