saveinmed/backend/internal/repository/postgres/migrations/0007_shipping_settings.sql
Gabbriiel 90467db1ec refactor: substitui backend Medusa por backend Go e corrige testes do marketplace
- Remove backend Medusa.js (TypeScript) e substitui pelo backend Go (saveinmed-performance-core)
- Corrige testes auth.test.ts: alinha paths de API (v1/ sem barra inicial) e campo access_token
- Corrige GroupedProductCard.test.tsx: ajusta distância formatada (toFixed) e troca userEvent por fireEvent com fakeTimers
- Corrige AuthContext.test.tsx: usa vi.hoisted() para mocks e corrige parênteses no waitFor

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 04:56:37 -06:00

25 lines
878 B
SQL

CREATE TABLE IF NOT EXISTS shipping_settings (
vendor_id UUID PRIMARY KEY,
active BOOLEAN DEFAULT true,
-- Configuração de Entrega
max_radius_km DOUBLE PRECISION DEFAULT 0,
price_per_km_cents BIGINT DEFAULT 0,
min_fee_cents BIGINT DEFAULT 0,
free_shipping_threshold_cents BIGINT, -- Nova opção de frete grátis
-- Configuração de Retirada
pickup_active BOOLEAN DEFAULT false,
pickup_address TEXT, -- JSON ou texto formatado
pickup_hours TEXT,
-- Geolocalização da loja (para cálculo do raio)
latitude DOUBLE PRECISION,
longitude DOUBLE PRECISION,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Index para busca rápida por vendedor
CREATE INDEX IF NOT EXISTS idx_shipping_settings_vendor_id ON shipping_settings(vendor_id);