2023-02-07 03:57:54 -05:00
|
|
|
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS is_domestic text null;
|
2023-02-07 04:31:43 -05:00
|
|
|
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS community_type_worth_keeping_total integer DEFAULT 0;
|
2023-02-09 14:49:41 -05:00
|
|
|
|
|
|
|
-- Provide counts for already liked typologies
|
|
|
|
UPDATE buildings
|
|
|
|
SET community_type_worth_keeping_total = (
|
|
|
|
SELECT count(*)
|
|
|
|
FROM building_user_attributes
|
|
|
|
WHERE buildings.building_id = building_user_attributes.building_id
|
|
|
|
AND community_type_worth_keeping = TRUE
|
|
|
|
)
|
|
|
|
WHERE buildings.building_id in (
|
|
|
|
SELECT DISTINCT building_id
|
|
|
|
FROM building_user_attributes
|
|
|
|
);
|