ALTER TABLE public.investments
  ADD COLUMN IF NOT EXISTS investment_type text NOT NULL DEFAULT 'profit_sharing',
  ADD COLUMN IF NOT EXISTS tenure_months integer NOT NULL DEFAULT 0,
  ADD COLUMN IF NOT EXISTS maturity_date date,
  ADD COLUMN IF NOT EXISTS fixed_rate numeric NOT NULL DEFAULT 0;

ALTER TABLE public.investments
  DROP CONSTRAINT IF EXISTS investments_investment_type_check;
ALTER TABLE public.investments
  ADD CONSTRAINT investments_investment_type_check
  CHECK (investment_type IN ('fixed','profit_sharing'));