-- Link godowns to branches and products to godowns
ALTER TABLE public.godowns ADD COLUMN IF NOT EXISTS branch_id uuid;
ALTER TABLE public.products ADD COLUMN IF NOT EXISTS godown_id uuid;

CREATE INDEX IF NOT EXISTS idx_godowns_branch_id ON public.godowns(branch_id);
CREATE INDEX IF NOT EXISTS idx_products_godown_id ON public.products(godown_id);
CREATE INDEX IF NOT EXISTS idx_godown_stocks_product ON public.godown_stocks(product_id);
CREATE INDEX IF NOT EXISTS idx_godown_stocks_godown ON public.godown_stocks(godown_id);