BalestraPatrick / HomeKitty

A Vapor 3 website to easily browse HomeKit accessories.
https://homekitty.world
MIT License
74 stars 9 forks source link

Changed price from String to double #144

Closed kimdv closed 6 years ago

kimdv commented 6 years ago

SQL query to update table

UPDATE accessories SET price = replace(price, '$', '');
ALTER TABLE accessories ALTER COLUMN price TYPE double precision  USING CAST(price as double precision);
BalestraPatrick commented 6 years ago

Looks great! I only modified the contribution form to support the optional price value and changed the AccessoryResponse to still render the price as a String? to be able to customize the number of floating point digits. If the DB has a price of 33, it was rendered as $33.0 but for consistency we should keep 2 floating digits.