Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove layerv1 artifacts #5092

Merged
merged 1 commit into from
Jun 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions commons/alembic.ini
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[DEFAULT]
app.cfg = %(here)s/alembic.yaml
script_location = /opt/alembic
script_location = c2cgeoportal_commons:alembic
version_table = alembic_version

[main]
type = main
version_locations = /opt/alembic/main/
version_locations = c2cgeoportal_commons:alembic/main/

[static]
type = static
version_locations = /opt/alembic/static/
version_locations = c2cgeoportal_commons:alembic/static/

# Logging configuration
[loggers]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# -*- coding: utf-8 -*-

# Copyright (c) 2019, Camptocamp SA
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:

# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.

# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# The views and conclusions contained in the software and documentation are those
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of the FreeBSD Project.

"""Fix removing layerv1

Revision ID: 56dc90838d90
Revises: 1de20166b274
Create Date: 2019-06-25 17:56:25.991417
"""

from alembic import op
from c2c.template.config import config

# revision identifiers, used by Alembic.
revision = '56dc90838d90'
down_revision = '1de20166b274'
branch_labels = None
depends_on = None


def upgrade():
schema = config['schema']

op.execute((
"DELETE from {schema}.layer_restrictionarea WHERE layer_id IN ("
"SELECT id from {schema}.treeitem WHERE type = 'layerv1'"
");"
).format(schema=schema))
op.execute("DELETE from {schema}.treeitem WHERE type = 'layerv1';".format(schema=schema))


def downgrade():
pass
6 changes: 3 additions & 3 deletions doc/developer/server_side.rst.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ Add a new script in c2cgeoportal root directory:

.. prompt:: bash

docker-compose exec geoportal alembic \
--config geoportal/tests/functional/alembic.ini \
python3 -m pip install --user -e commons
alembic --config=commons/alembic.ini \
--name=[main|static] \
revision --message "<Explicit name>"

This will generate the migration script in
``commons/c2cgeoportal/commons/alembic/[main|static]/xxx_<Explicite_name>.py``.
``commons/c2cgeoportal_commons/alembic/[main|static]/xxx_<Explicite_name>.py``.

To get the project schema, use:
``schema = context.get_context().config.get_main_option('schema')``
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ services:
alembic:
image: ${DOCKER_BASE}-geoportal:${DOCKER_TAG}
user: www-data
entrypoint: []
command:
- alembic
- --name=static
Expand Down