~jomco/straatnaam

978317f28fbfb30268c7fb70c19241a08c7fcba5 — Remco van 't Veer 1 year, 11 months ago 178aab4
Expose verblijfsobject and pand tables

SELECT
  bag.*, vbo.oppervlakte, pnd.oorspronkelijk_bouwjaar
FROM
  bag
LEFT JOIN
  verblijfsobject vbo
ON
  vbo.id = bag.object_id
LEFT JOIN
  verblijfsobject_pand vbo_pnd
ON
  vbo_pnd.id = bag.object_id
LEFT JOIN
  pand pnd
ON
  vbo_pnd.pand_id = pnd.id
1 files changed, 14 insertions(+), 2 deletions(-)

M src/straatnaam/data.clj
M src/straatnaam/data.clj => src/straatnaam/data.clj +14 -2
@@ 31,8 31,20 @@
  "Select bag data in given version (schema name) as current."
  [db sn]
  (sql/db-do-commands db true
                      ["DROP VIEW IF EXISTS bag"
                       (str "CREATE VIEW bag AS SELECT * FROM " sn ".bag")])
                      [(str "DROP VIEW IF EXISTS public.bag")
                       (str "CREATE VIEW public.bag AS SELECT * FROM " sn ".bag")

                       (str "DROP VIEW IF EXISTS public.verblijfsobject")
                       (str "CREATE VIEW public.verblijfsobject AS
                             SELECT * FROM " sn ".verblijfsobject WHERE einddatum IS NULL")

                       (str "DROP VIEW IF EXISTS public.pand")
                       (str "CREATE VIEW public.pand AS
                             SELECT * FROM " sn ".pand WHERE einddatum IS NULL")

                       (str "DROP VIEW IF EXISTS public.verblijfsobject_pand")
                       (str "CREATE VIEW public.verblijfsobject_pand AS
                             SELECT * FROM " sn ".verblijfsobject_pand")])
  (log/info "version activated:" sn))

(defn version-ok?