Files
pagodera/lib/db/migrations/005_bids.sql
T
Evandro Fonseca Junior 55eebde0ba feat: add user authentication UI to header component
Add login and register dialogs, user dropdown menu with profile link and logout option, and integrate with session management hook. Prevent hydration mismatches by conditionally rendering auth elements after mount. Update package-lock.json with new @esbuild dependencies for build tooling.
2025-11-04 02:33:29 -03:00

21 lines
879 B
SQL

-- Migration 005: Tabela de lances em leilões
-- Criado em: 2025-01-27
-- Tabela de lances
CREATE TABLE IF NOT EXISTS bids (
bid_id SERIAL PRIMARY KEY,
listing_id INTEGER NOT NULL REFERENCES listings(listing_id) ON DELETE CASCADE,
bidder_id INTEGER NOT NULL REFERENCES users(user_id) ON DELETE CASCADE,
bid_amount DECIMAL(10, 2) NOT NULL,
bid_type VARCHAR(20) CHECK (bid_type IN ('pix', 'tibia_coins', 'gold_coins')),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
is_active BOOLEAN DEFAULT TRUE
);
-- Índices para performance
CREATE INDEX IF NOT EXISTS idx_bids_listing ON bids(listing_id);
CREATE INDEX IF NOT EXISTS idx_bids_bidder ON bids(bidder_id);
CREATE INDEX IF NOT EXISTS idx_bids_active ON bids(is_active) WHERE is_active = TRUE;
CREATE INDEX IF NOT EXISTS idx_bids_amount ON bids(listing_id, bid_amount DESC) WHERE is_active = TRUE;