migrations for the roomtypes (#513)
* migrations for the roomtypes * rename files * updated types * Correct migration numbers and cleanup
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
-- Add interiors id to v_interior_image_urls
|
||||
|
||||
CREATE OR REPLACE VIEW v_interior_image_urls AS
|
||||
SELECT
|
||||
interiors.id interior_id,
|
||||
"product-printproducts".productid,
|
||||
interiors.print_id,
|
||||
"product-printproducts".groupid AS product_group,
|
||||
rooms.id AS room_id,
|
||||
rooms.name AS room_name,
|
||||
interiors.position,
|
||||
room_types.name AS room_type,
|
||||
CASE
|
||||
WHEN interiors.room_id IS null THEN
|
||||
'/interior-images/' || interiors.id || '.jpg'
|
||||
ELSE
|
||||
'/interiors/' || "product-printproducts".productid || '/' || rooms.s3_suffix
|
||||
END as uri,
|
||||
array_agg(roomtypes.name) FILTER (WHERE roomtypes.admin_specific = false) AS room_types
|
||||
FROM interiors
|
||||
JOIN "product-printproducts" ON "product-printproducts".printid = interiors.print_id
|
||||
JOIN "product-groups" ON "product-groups".groupid = "product-printproducts".groupid
|
||||
LEFT JOIN rooms ON interiors.room_id = rooms.id
|
||||
LEFT JOIN room_types ON room_types.id = rooms.room_type_id
|
||||
LEFT JOIN room_roomtypes ON room_roomtypes.room_id = rooms.id
|
||||
LEFT JOIN roomtypes ON roomtypes.id = room_roomtypes.roomtype_id
|
||||
GROUP BY
|
||||
interiors.id,
|
||||
"product-printproducts".productid,
|
||||
interiors.print_id,
|
||||
"product-printproducts".groupid,
|
||||
rooms.id,
|
||||
rooms.name,
|
||||
interiors.position,
|
||||
room_types.name,
|
||||
rooms.s3_suffix;
|
||||
Reference in New Issue
Block a user