diff --git a/docker-compose.yml b/docker-compose.yml index 5a631b2b6..28d0a149a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -68,3 +68,12 @@ services: # Allow accessing host ports from this container via host.docker.internal on Linux # https://stackoverflow.com/a/43541732 - host.docker.internal:host-gateway + + pg_featureserv: + # https://github.com/crunchydata/pg_featureserv + image: pramsey/pg_featureserv:20240706 + ports: + - 8889:8889 + environment: + DATABASE_URL: "postgresql://dialog:dialog@database:5432/dialog_featureserver" # TODO: config + PGFS_SERVER_HTTPPORT: 8889 diff --git a/src/Infrastructure/Persistence/Doctrine/Migrations/Version20241107095421.php b/src/Infrastructure/Persistence/Doctrine/Migrations/Version20241107095421.php new file mode 100644 index 000000000..ed6dd228b --- /dev/null +++ b/src/Infrastructure/Persistence/Doctrine/Migrations/Version20241107095421.php @@ -0,0 +1,62 @@ +addSql('CREATE MATERIALIZED VIEW featureserver_restrictions AS + SELECT + loc.geometry::geometry(geometry, 4326) AS geometry, + m.type AS measure_type, + p.start_datetime, + p.end_datetime, + v.restricted_types, + v.other_restricted_type_text, + v.exempted_types, + v.other_exempted_type_text, + v.critair_types, + v.heavyweight_max_weight, + v.max_width, + v.max_length, + v.max_height, + loc.road_type AS location_type, + ns.city_code, + ns.city_label, + ns.road_name, + nr.road_number, + nr.administrator, + nr.from_point_number, + nr.from_side, + nr.from_abscissa, + nr.to_point_number, + nr.to_side, + nr.to_abscissa, + rg.label AS geojson_label + FROM period AS p + INNER JOIN measure AS m ON m.uuid = p.measure_uuid + INNER JOIN location AS loc ON loc.measure_uuid = m.uuid + LEFT OUTER JOIN vehicle_set AS v ON v.measure_uuid = m.uuid + LEFT OUTER JOIN named_street AS ns ON ns.location_uuid = loc.uuid + LEFT OUTER JOIN numbered_road AS nr ON nr.location_uuid = nr.uuid + LEFT OUTER JOIN raw_geojson AS rg ON rg.location_uuid = rg.uuid + WITH DATA + '); + } + + public function down(Schema $schema): void + { + $this->addSql('DROP MATERIALIZED VIEW featureserver_restrictions'); + } +}