-- Schema Migration 002: Raw Wallet Transactions CREATE TABLE IF NOT EXISTS raw_wallet_transactions ( transaction_signature VARCHAR(128) PRIMARY KEY, source_wallet VARCHAR(88) NOT NULL, slot BIGINT NOT NULL, block_time TIMESTAMP WITH TIME ZONE, detected_at TIMESTAMP WITH TIME ZONE NOT NULL, raw_payload JSONB NOT NULL, parser_version VARCHAR(50) NOT NULL, created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() ); CREATE INDEX IF NOT EXISTS idx_raw_tx_wallet ON raw_wallet_transactions(source_wallet); CREATE INDEX IF NOT EXISTS idx_raw_tx_slot ON raw_wallet_transactions(slot); -- Update copy_signals to have lamports, base units, token decimals, and parser version ALTER TABLE copy_signals ADD COLUMN IF NOT EXISTS source_amount_lamports BIGINT; ALTER TABLE copy_signals ADD COLUMN IF NOT EXISTS token_amount_base_units VARCHAR(78); ALTER TABLE copy_signals ADD COLUMN IF NOT EXISTS token_decimals INTEGER; ALTER TABLE copy_signals ADD COLUMN IF NOT EXISTS parser_version VARCHAR(50);