-- Migrate IndustrialPark and IndustrialListing USD money fields from
-- double precision (Float) to numeric(18, 4) (Decimal) to preserve exact
-- precision for money. USING casts keep existing data intact.

-- IndustrialPark
ALTER TABLE "IndustrialPark"
  ALTER COLUMN "landRentUsdM2Year" TYPE numeric(18, 4) USING "landRentUsdM2Year"::numeric(18, 4),
  ALTER COLUMN "rbfRentUsdM2Month" TYPE numeric(18, 4) USING "rbfRentUsdM2Month"::numeric(18, 4),
  ALTER COLUMN "rbwRentUsdM2Month" TYPE numeric(18, 4) USING "rbwRentUsdM2Month"::numeric(18, 4),
  ALTER COLUMN "managementFeeUsd"  TYPE numeric(18, 4) USING "managementFeeUsd"::numeric(18, 4);

-- IndustrialListing
ALTER TABLE "IndustrialListing"
  ALTER COLUMN "priceUsdM2"      TYPE numeric(18, 4) USING "priceUsdM2"::numeric(18, 4),
  ALTER COLUMN "totalLeasePrice" TYPE numeric(18, 4) USING "totalLeasePrice"::numeric(18, 4),
  ALTER COLUMN "managementFee"   TYPE numeric(18, 4) USING "managementFee"::numeric(18, 4);
