Skip to content

Commit

Permalink
Be able to have dynamic geo_table
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Aug 29, 2019
1 parent af74687 commit 2bd3206
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
15 changes: 12 additions & 3 deletions doc/integrator/database.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ Prepare the project
To be able to proceed like this, the variables ``PGSCHEMA`` and the ``DOCKER_PGSCHEMA_STATIC``
should be managed in your makefiles:

* the ``PGSCHEMA`` variable should be set in the ``Makefile``, in this example, it will be set to ``main_2019``.
* the ``DOCKER_PGSCHEMA_STATIC`` variable for production should be set in a specific makefile
* The ``PGSCHEMA`` variable should be set in the ``Makefile``, in this example, it will be set to
``main_2019``.
* The ``DOCKER_PGSCHEMA_STATIC`` variable for production should be set in a specific makefile
for production e.-g. ``production.mk``, it will be set for example to ``integration_static`` in the
Makefile, and to ``production_static`` in the production makefile.
* the line ``PGSCHEMA=${docker_schema}`` should be removed from your ``.env.mako`` file.
* The line ``PGSCHEMA=${docker_schema}`` should be removed from your ``.env.mako`` file.


Start a new version
Expand Down Expand Up @@ -110,3 +111,11 @@ Publish the new version on production: now, integration and production both use
For OpenShift projects, just push the integration branch into the production branch.

The schema ``main_2019`` still exists, so if needed, the production can be rolled back to this content.


Editing
~~~~~~~

To have a differant schema for the geodata used in the editing we can defined the geo_table like
``{GEODATA_SCHEMA}.table`` where ``{GEODATA_SCHEMA}`` will be replaced by the ``GEODATA_SCHEMA``
environment variable.
3 changes: 2 additions & 1 deletion geoportal/c2cgeoportal_geoportal/views/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of the FreeBSD Project.

import os
from datetime import datetime

from pyramid.httpexceptions import HTTPInternalServerError, \
Expand Down Expand Up @@ -498,7 +499,7 @@ def get_layer_class(layer, with_last_update_columns=False):

primary_key = Layers.get_metadata(layer, "geotablePrimaryKey")
cls = get_class(
str(layer.geo_table),
str(layer.geo_table.format(os.environ)),
exclude_properties=exclude,
primary_key=primary_key,
attributes_order=attributes_order,
Expand Down

0 comments on commit 2bd3206

Please sign in to comment.