CREATE TABLE IF NOT EXISTS addresses (
    id UUID PRIMARY KEY,
    entity_id UUID NOT NULL, -- UserID or CompanyID
    title TEXT NOT NULL,
    zip_code TEXT NOT NULL,
    street TEXT NOT NULL,
    number TEXT NOT NULL,
    complement TEXT,
    district TEXT NOT NULL,
    city TEXT NOT NULL,
    state TEXT NOT NULL,
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE INDEX IF NOT EXISTS idx_addresses_entity_id ON addresses(entity_id);
