saveinmed/backend/internal/repository/postgres/migrations/0002_shipping_methods.sql
2025-12-20 10:47:37 -03:00

16 lines
586 B
SQL

CREATE TABLE IF NOT EXISTS shipping_methods (
id UUID PRIMARY KEY,
vendor_id UUID NOT NULL REFERENCES companies(id),
type TEXT NOT NULL,
active BOOLEAN NOT NULL DEFAULT FALSE,
preparation_minutes INT NOT NULL DEFAULT 0,
max_radius_km DOUBLE PRECISION NOT NULL DEFAULT 0,
min_fee_cents BIGINT NOT NULL DEFAULT 0,
price_per_km_cents BIGINT NOT NULL DEFAULT 0,
free_shipping_threshold_cents BIGINT,
pickup_address TEXT,
pickup_hours TEXT,
created_at TIMESTAMPTZ NOT NULL,
updated_at TIMESTAMPTZ NOT NULL,
UNIQUE (vendor_id, type)
);