-- Convert text columns to numeric. NULLs survive; empty strings become NULL;
-- whitespace is trimmed before casting so legacy data with stray spaces converts cleanly.
ALTER TABLE "berths"
  ALTER COLUMN "nominal_boat_size" SET DATA TYPE numeric
  USING NULLIF(TRIM("nominal_boat_size"), '')::numeric;--> statement-breakpoint
ALTER TABLE "berths"
  ALTER COLUMN "nominal_boat_size_m" SET DATA TYPE numeric
  USING NULLIF(TRIM("nominal_boat_size_m"), '')::numeric;--> statement-breakpoint
ALTER TABLE "berths"
  ALTER COLUMN "power_capacity" SET DATA TYPE numeric
  USING NULLIF(TRIM("power_capacity"), '')::numeric;--> statement-breakpoint
ALTER TABLE "berths"
  ALTER COLUMN "voltage" SET DATA TYPE numeric
  USING NULLIF(TRIM("voltage"), '')::numeric;--> statement-breakpoint
ALTER TABLE "berths" ADD COLUMN "status_override_mode" text;