c2cgeoportal-commons 2.7.1.145__py3-none-any.whl → 2.9.0.350__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. c2cgeoportal_commons/__init__.py +1 -1
  2. c2cgeoportal_commons/alembic/env.py +18 -15
  3. c2cgeoportal_commons/alembic/main/028477929d13_add_technical_roles.py +3 -3
  4. c2cgeoportal_commons/alembic/main/04f05bfbb05e_remove_the_old_is_expanded_column.py +3 -1
  5. c2cgeoportal_commons/alembic/main/116b9b79fc4d_internal_and_external_layer_tables_.py +35 -39
  6. c2cgeoportal_commons/alembic/main/1418cb05921b_merge_1_6_and_master_branches.py +2 -4
  7. c2cgeoportal_commons/alembic/main/164ac0819a61_add_image_format_to_wmts_layer.py +2 -2
  8. c2cgeoportal_commons/alembic/main/166ff2dcc48d_create_database.py +5 -5
  9. c2cgeoportal_commons/alembic/main/16e43f8c0330_remove_old_metadata_column.py +2 -2
  10. c2cgeoportal_commons/alembic/main/1d5d4abfebd1_add_restricted_theme.py +3 -3
  11. c2cgeoportal_commons/alembic/main/1de20166b274_remove_v1_artifacts.py +2 -2
  12. c2cgeoportal_commons/alembic/main/20137477bd02_update_icons_url.py +2 -2
  13. c2cgeoportal_commons/alembic/main/21f11066f8ec_trigger_on_role_updates_user_in_static.py +14 -16
  14. c2cgeoportal_commons/alembic/main/22e6dfb556de_add_description_tree_.py +2 -2
  15. c2cgeoportal_commons/alembic/main/29f2a32859ec_merge_1_6_and_master_branches.py +2 -4
  16. c2cgeoportal_commons/alembic/main/2b8ed8c1df94_set_layergroup_treeitem_is_as_a_primary_.py +2 -2
  17. c2cgeoportal_commons/alembic/main/2e57710fecfe_update_the_ogc_server_for_ogc_api.py +77 -0
  18. c2cgeoportal_commons/alembic/main/32527659d57b_move_exclude_properties_from_layerv1_to_.py +8 -8
  19. c2cgeoportal_commons/alembic/main/32b21aa1d0ed_merge_e004f76e951a_and_e004f76e951a_.py +2 -4
  20. c2cgeoportal_commons/alembic/main/338b57593823_remove_trigger_on_role_name_change.py +16 -18
  21. c2cgeoportal_commons/alembic/main/415746eb9f6_changes_for_v2.py +31 -31
  22. c2cgeoportal_commons/alembic/main/44c91d82d419_add_table_log.py +72 -0
  23. c2cgeoportal_commons/alembic/main/5109242131ce_add_column_time_widget.py +4 -3
  24. c2cgeoportal_commons/alembic/main/52916d8fde8b_add_sql_fields_to_vector_tiles.py +5 -3
  25. c2cgeoportal_commons/alembic/main/53ba1a68d5fe_add_theme_to_fulltextsearch.py +2 -2
  26. c2cgeoportal_commons/alembic/main/54645a535ad6_add_ordering_in_relation.py +10 -10
  27. c2cgeoportal_commons/alembic/main/56dc90838d90_fix_removing_layerv1.py +2 -2
  28. c2cgeoportal_commons/alembic/main/596ba21e3833_separate_local_internal.py +6 -10
  29. c2cgeoportal_commons/alembic/main/678f88c7ad5e_add_vector_tiles_layers_table.py +2 -2
  30. c2cgeoportal_commons/alembic/main/6a412d9437b1_rename_serverogc_to_ogcserver.py +4 -4
  31. c2cgeoportal_commons/alembic/main/6d87fdad275a_convert_metadata_to_the_right_case.py +2 -2
  32. c2cgeoportal_commons/alembic/main/7530011a66a7_trigger_on_role_updates_user_in_static.py +14 -16
  33. c2cgeoportal_commons/alembic/main/78fd093c8393_add_api_s_intrfaces.py +30 -49
  34. c2cgeoportal_commons/alembic/main/7d271f4527cd_add_layer_column_in_layerv1_table.py +2 -2
  35. c2cgeoportal_commons/alembic/main/809650bd04c3_add_dimension_field.py +2 -2
  36. c2cgeoportal_commons/alembic/main/8117bb9bba16_use_dimension_on_all_the_layers.py +4 -4
  37. c2cgeoportal_commons/alembic/main/87f8330ed64e_add_missing_delete_cascades.py +2 -2
  38. c2cgeoportal_commons/alembic/main/9268a1dffac0_add_trigger_to_be_able_to_correctly_.py +2 -2
  39. c2cgeoportal_commons/alembic/main/94db7e7e5b21_merge_2_2_and_master_branches.py +2 -4
  40. c2cgeoportal_commons/alembic/main/951ff84bd8ec_be_able_to_delete_a_wms_layer_in_sql.py +2 -2
  41. c2cgeoportal_commons/alembic/main/a00109812f89_add_field_layer_wms_valid.py +4 -4
  42. c2cgeoportal_commons/alembic/main/a4558f032d7d_add_support_of_cog_layers.py +74 -0
  43. c2cgeoportal_commons/alembic/main/a4f1aac9bda_merge_1_6_and_master_branches.py +2 -4
  44. c2cgeoportal_commons/alembic/main/b60f2a505f42_remame_uimetadata_to_metadata.py +2 -2
  45. c2cgeoportal_commons/alembic/main/b6b09f414fe8_sync_model_database.py +174 -0
  46. c2cgeoportal_commons/alembic/main/c75124553bf3_remove_deprecated_columns.py +2 -2
  47. c2cgeoportal_commons/alembic/main/d48a63b348f1_change_mapserver_url_for_docker.py +6 -10
  48. c2cgeoportal_commons/alembic/main/d8ef99bc227e_be_able_to_delete_a_linked_functionality.py +2 -2
  49. c2cgeoportal_commons/alembic/main/daf738d5bae4_merge_2_0_and_master_branches.py +2 -4
  50. c2cgeoportal_commons/alembic/main/dba87f2647f9_merge_2_2_on_2_3.py +2 -4
  51. c2cgeoportal_commons/alembic/main/e004f76e951a_add_missing_not_null.py +6 -22
  52. c2cgeoportal_commons/alembic/main/e7e03dedade3_put_the_default_wms_server_in_the_.py +6 -10
  53. c2cgeoportal_commons/alembic/main/e85afd327ab3_cascade_deletes_to_tsearch.py +2 -2
  54. c2cgeoportal_commons/alembic/main/ec82a8906649_add_missing_on_delete_cascade_on_layer_.py +2 -2
  55. c2cgeoportal_commons/alembic/main/ee25d267bf46_main_interface_desktop.py +4 -10
  56. c2cgeoportal_commons/alembic/main/eeb345672454_merge_2_4_and_master_branches.py +2 -4
  57. c2cgeoportal_commons/alembic/static/0c640a58a09a_add_opt_key_column.py +2 -2
  58. c2cgeoportal_commons/alembic/static/107b81f5b9fe_add_missing_delete_cascades.py +2 -2
  59. c2cgeoportal_commons/alembic/static/1857owc78a07_add_last_login_and_expiration_date.py +2 -2
  60. c2cgeoportal_commons/alembic/static/1da396a88908_move_user_table_to_static_schema.py +6 -10
  61. c2cgeoportal_commons/alembic/static/267b4c1bde2e_add_display_name_in_the_user_for_better_.py +62 -0
  62. c2cgeoportal_commons/alembic/static/3f89a7d71a5e_alter_column_url_to_remove_limitation.py +2 -2
  63. c2cgeoportal_commons/alembic/static/44c91d82d419_add_table_log.py +72 -0
  64. c2cgeoportal_commons/alembic/static/53d671b17b20_add_timezone_on_datetime_fields.py +2 -2
  65. c2cgeoportal_commons/alembic/static/5472fbc19f39_add_temp_password_column.py +2 -2
  66. c2cgeoportal_commons/alembic/static/76d72fb3fcb9_add_oauth2_pkce.py +70 -0
  67. c2cgeoportal_commons/alembic/static/7ef947f30f20_add_oauth2_tables.py +3 -1
  68. c2cgeoportal_commons/alembic/static/910b4ca53b68_sync_model_database.py +186 -0
  69. c2cgeoportal_commons/alembic/static/aa41e9613256_wip_add_openid_connect_support.py +64 -0
  70. c2cgeoportal_commons/alembic/static/ae5e88f35669_add_table_user_role.py +8 -14
  71. c2cgeoportal_commons/alembic/static/bd029dbfc11a_fill_tech_data_column.py +2 -2
  72. c2cgeoportal_commons/lib/email_.py +15 -19
  73. c2cgeoportal_commons/lib/literal.py +3 -3
  74. c2cgeoportal_commons/lib/url.py +15 -16
  75. c2cgeoportal_commons/lib/validators.py +1 -3
  76. c2cgeoportal_commons/models/__init__.py +16 -9
  77. c2cgeoportal_commons/models/main.py +415 -226
  78. c2cgeoportal_commons/models/sqlalchemy.py +13 -13
  79. c2cgeoportal_commons/models/static.py +162 -71
  80. c2cgeoportal_commons/testing/__init__.py +12 -7
  81. c2cgeoportal_commons/testing/initializedb.py +7 -6
  82. {c2cgeoportal_commons-2.7.1.145.dist-info → c2cgeoportal_commons-2.9.0.350.dist-info}/METADATA +4 -5
  83. c2cgeoportal_commons-2.9.0.350.dist-info/RECORD +89 -0
  84. {c2cgeoportal_commons-2.7.1.145.dist-info → c2cgeoportal_commons-2.9.0.350.dist-info}/WHEEL +1 -1
  85. tests/conftest.py +1 -1
  86. c2cgeoportal_commons-2.7.1.145.dist-info/RECORD +0 -80
  87. {c2cgeoportal_commons-2.7.1.145.dist-info → c2cgeoportal_commons-2.9.0.350.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2019-2021, Camptocamp SA
1
+ # Copyright (c) 2019-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -25,16 +25,17 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
- Add API's intrfaces.
31
+ Add API's interfaces.
32
32
 
33
33
  Revision ID: 78fd093c8393
34
34
  Revises: e85afd327ab3
35
35
  Create Date: 2019-08-29 07:56:15.547216
36
36
  """
37
37
 
38
+ import sqlalchemy
38
39
  from alembic import op
39
40
  from c2c.template.config import config
40
41
  from sqlalchemy import Column, MetaData, Table
@@ -56,38 +57,28 @@ def upgrade() -> None:
56
57
  connection = op.get_bind()
57
58
  for interface_name in ("api", "iframe_api"):
58
59
  result = connection.execute(
59
- "SELECT count(name) FROM {schema}.interface WHERE name='{name}'".format(
60
- name=interface_name, schema=schema
61
- )
60
+ sqlalchemy.text(f"SELECT count(name) FROM {schema}.interface WHERE name=:interface_name"),
61
+ {"interface_name": interface_name},
62
62
  )
63
- if result.fetchone()[0] == 0:
63
+ if result.fetchone()[0] == 0: # type: ignore[index]
64
64
  op.bulk_insert(interface, [{"name": interface_name}])
65
65
  for interface_name in ("edit", "routing"):
66
66
  result = connection.execute(
67
- "SELECT count(name) FROM {schema}.interface WHERE name='{name}'".format(
68
- name=interface_name, schema=schema
69
- )
67
+ sqlalchemy.text(f"SELECT count(name) FROM {schema}.interface WHERE name=:interface_name"),
68
+ {"interface_name": interface_name},
70
69
  )
71
- if result.fetchone()[0] != 0:
72
- op.execute(
73
- "DELETE FROM {schema}.interface_theme it "
74
- "USING {schema}.interface i "
75
- "WHERE it.interface_id = i.id AND i.name = '{name}'".format(
76
- name=interface_name, schema=schema
77
- )
78
- )
70
+ if result.fetchone()[0] != 0: # type: ignore[index]
79
71
  op.execute(
80
- "DELETE FROM {schema}.interface_layer il "
81
- "USING {schema}.interface i "
82
- "WHERE il.interface_id = i.id AND i.name = '{name}'".format(
83
- name=interface_name, schema=schema
84
- )
72
+ f"DELETE FROM {schema}.interface_theme it "
73
+ f"USING {schema}.interface i "
74
+ f"WHERE it.interface_id = i.id AND i.name = '{interface_name}'"
85
75
  )
86
76
  op.execute(
87
- "DELETE FROM {schema}.interface WHERE name='{name}'".format(
88
- name=interface_name, schema=schema
89
- )
77
+ f"DELETE FROM {schema}.interface_layer il "
78
+ f"USING {schema}.interface i "
79
+ f"WHERE il.interface_id = i.id AND i.name = '{interface_name}'"
90
80
  )
81
+ op.execute(f"DELETE FROM {schema}.interface WHERE name='{interface_name}'")
91
82
 
92
83
 
93
84
  def downgrade() -> None:
@@ -99,35 +90,25 @@ def downgrade() -> None:
99
90
  connection = op.get_bind()
100
91
  for interface_name in ("edit", "routing"):
101
92
  result = connection.execute(
102
- "SELECT count(name) FROM {schema}.interface WHERE name='{name}'".format(
103
- name=interface_name, schema=schema
104
- )
93
+ sqlalchemy.text(f"SELECT count(name) FROM {schema}.interface WHERE name=:interface_name"),
94
+ {"interface_name": interface_name},
105
95
  )
106
- if result.fetchone()[0] == 0:
96
+ if result.fetchone()[0] == 0: # type: ignore[index]
107
97
  op.bulk_insert(interface, [{"name": interface_name}])
108
98
  for interface_name in ("api", "iframe_api"):
109
99
  result = connection.execute(
110
- "SELECT count(name) FROM {schema}.interface WHERE name='{name}'".format(
111
- name=interface_name, schema=schema
112
- )
100
+ sqlalchemy.text(f"SELECT count(name) FROM {schema}.interface WHERE name=:interface_name"),
101
+ {"interface_name": interface_name},
113
102
  )
114
- if result.fetchone()[0] != 0:
115
- op.execute(
116
- "DELETE FROM {schema}.interface_theme it "
117
- "USING {schema}.interface i "
118
- "WHERE it.interface_id = i.id AND i.name = '{name}'".format(
119
- name=interface_name, schema=schema
120
- )
121
- )
103
+ if result.fetchone()[0] != 0: # type: ignore[index]
122
104
  op.execute(
123
- "DELETE FROM {schema}.interface_layer il "
124
- "USING {schema}.interface i "
125
- "WHERE il.interface_id = i.id AND i.name = '{name}'".format(
126
- name=interface_name, schema=schema
127
- )
105
+ f"DELETE FROM {schema}.interface_theme it "
106
+ f"USING {schema}.interface i "
107
+ f"WHERE it.interface_id = i.id AND i.name = '{interface_name}'"
128
108
  )
129
109
  op.execute(
130
- "DELETE FROM {schema}.interface WHERE name='{name}'".format(
131
- name=interface_name, schema=schema
132
- )
110
+ f"DELETE FROM {schema}.interface_layer il "
111
+ f"USING {schema}.interface i "
112
+ f"WHERE il.interface_id = i.id AND i.name = '{interface_name}'"
133
113
  )
114
+ op.execute(f"DELETE FROM {schema}.interface WHERE name='{interface_name}'")
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2016-2019, Camptocamp SA
1
+ # Copyright (c) 2016-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  Add layer column in layerv1 table.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2018-2019, Camptocamp SA
1
+ # Copyright (c) 2018-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  Add dimension field.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2016-2019, Camptocamp SA
1
+ # Copyright (c) 2016-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  Use dimension on all the layers.
@@ -50,7 +50,7 @@ def upgrade() -> None:
50
50
  schema = config["schema"]
51
51
 
52
52
  op.rename_table("wmts_dimension", "dimension", schema=schema)
53
- with op.batch_alter_table("dimension", schema=schema) as table_op: # type: ignore
53
+ with op.batch_alter_table("dimension", schema=schema) as table_op:
54
54
  table_op.drop_constraint("wmts_dimension_layer_id_fkey", type_="foreignkey")
55
55
  table_op.create_foreign_key(
56
56
  "dimension_layer_id_fkey",
@@ -65,7 +65,7 @@ def downgrade() -> None:
65
65
  """Downgrade."""
66
66
  schema = config["schema"]
67
67
 
68
- with op.batch_alter_table("dimension", schema=schema) as table_op: # type: ignore
68
+ with op.batch_alter_table("dimension", schema=schema) as table_op:
69
69
  table_op.drop_constraint("dimension_layer_id_fkey", type_="foreignkey")
70
70
  table_op.create_foreign_key(
71
71
  "wmts_dimension_layer_id_fkey",
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021, Camptocamp SA
1
+ # Copyright (c) 2020-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  Add missing delete cascades.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2017-2019, Camptocamp SA
1
+ # Copyright (c) 2017-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  Add trigger to be able to correctly change the role name.
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2017-2021, Camptocamp SA
1
+ # Copyright (c) 2017-2025, Camptocamp SA
4
2
  # All rights reserved.
5
3
 
6
4
  # Redistribution and use in source and binary forms, with or without
@@ -27,7 +25,7 @@
27
25
  # of the authors and should not be interpreted as representing official policies,
28
26
  # either expressed or implied, of the FreeBSD Project.
29
27
 
30
- # pylint: disable=no-member
28
+ # pylint: disable=invalid-name
31
29
 
32
30
  """
33
31
  Merge 2.2 and master branches.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2016-2019, Camptocamp SA
1
+ # Copyright (c) 2016-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  Be able to delete a WMS layer in SQL.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021, Camptocamp SA
1
+ # Copyright (c) 2020-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  Add field layer_wms.valid.
@@ -49,8 +49,8 @@ depends_on = None
49
49
  def upgrade() -> None:
50
50
  """Upgrade."""
51
51
  schema = config["schema"]
52
- op.add_column("layer_wms", sa.Column("valid", sa.Boolean(), nullable=True), schema=schema)
53
- op.add_column("layer_wms", sa.Column("invalid_reason", sa.Unicode(), nullable=True), schema=schema)
52
+ op.add_column("layer_wms", sa.Column("valid", sa.Boolean, nullable=True), schema=schema)
53
+ op.add_column("layer_wms", sa.Column("invalid_reason", sa.Unicode, nullable=True), schema=schema)
54
54
 
55
55
 
56
56
  def downgrade() -> None:
@@ -0,0 +1,74 @@
1
+ # Copyright (c) 2024-2025, Camptocamp SA
2
+ # All rights reserved.
3
+
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are met:
6
+
7
+ # 1. Redistributions of source code must retain the above copyright notice, this
8
+ # list of conditions and the following disclaimer.
9
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ # this list of conditions and the following disclaimer in the documentation
11
+ # and/or other materials provided with the distribution.
12
+
13
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14
+ # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
17
+ # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18
+ # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19
+ # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20
+ # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
+
24
+ # The views and conclusions contained in the software and documentation are those
25
+ # of the authors and should not be interpreted as representing official policies,
26
+ # either expressed or implied, of the FreeBSD Project.
27
+
28
+ # pylint: disable=invalid-name
29
+
30
+ """
31
+ Add support of COG layers.
32
+
33
+ Revision ID: a4558f032d7d
34
+ Revises: b6b09f414fe8
35
+ Create Date: 2024-04-22 12:22:09.336641
36
+ """
37
+
38
+ import sqlalchemy as sa
39
+ from alembic import op
40
+ from c2c.template.config import config
41
+
42
+ # revision identifiers, used by Alembic.
43
+ revision = "a4558f032d7d"
44
+ down_revision = "b6b09f414fe8"
45
+ branch_labels = None
46
+ depends_on = None
47
+
48
+
49
+ def upgrade() -> None:
50
+ """Upgrade."""
51
+ schema = config["schema"]
52
+
53
+ # ### commands auto generated by Alembic ###
54
+ op.create_table(
55
+ "layer_cog",
56
+ sa.Column("id", sa.Integer(), nullable=False),
57
+ sa.Column("url", sa.Unicode(), nullable=False),
58
+ sa.ForeignKeyConstraint(
59
+ ["id"],
60
+ [f"{schema}.layer.id"],
61
+ ),
62
+ sa.PrimaryKeyConstraint("id"),
63
+ schema=schema,
64
+ )
65
+ # ### end Alembic commands ###
66
+
67
+
68
+ def downgrade() -> None:
69
+ """Downgrade."""
70
+ schema = config["schema"]
71
+
72
+ # ### commands auto generated by Alembic ###
73
+ op.drop_table("layer_cog", schema=schema)
74
+ # ### end Alembic commands ###
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2015-2019, Camptocamp SA
1
+ # Copyright (c) 2015-2025, Camptocamp SA
4
2
  # All rights reserved.
5
3
 
6
4
  # Redistribution and use in source and binary forms, with or without
@@ -27,7 +25,7 @@
27
25
  # of the authors and should not be interpreted as representing official policies,
28
26
  # either expressed or implied, of the FreeBSD Project.
29
27
 
30
- # pylint: disable=no-member
28
+ # pylint: disable=invalid-name
31
29
 
32
30
  """
33
31
  Merge 1.6 and master branches.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2016-2019, Camptocamp SA
1
+ # Copyright (c) 2016-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  Remame UIMetadata to Metadata.
@@ -0,0 +1,174 @@
1
+ # Copyright (c) 2024-2025, Camptocamp SA
2
+ # All rights reserved.
3
+
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are met:
6
+
7
+ # 1. Redistributions of source code must retain the above copyright notice, this
8
+ # list of conditions and the following disclaimer.
9
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ # this list of conditions and the following disclaimer in the documentation
11
+ # and/or other materials provided with the distribution.
12
+
13
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14
+ # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
17
+ # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18
+ # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19
+ # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20
+ # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
+
24
+ # The views and conclusions contained in the software and documentation are those
25
+ # of the authors and should not be interpreted as representing official policies,
26
+ # either expressed or implied, of the FreeBSD Project.
27
+
28
+ # pylint: disable=invalid-name
29
+
30
+ """
31
+ Sync the model and the database.
32
+
33
+ Revision ID: b6b09f414fe8
34
+ Revises: 44c91d82d419
35
+ Create Date: 2024-04-22 07:17:25.399062
36
+ """
37
+
38
+ import sqlalchemy as sa
39
+ from alembic import op
40
+ from c2c.template.config import config
41
+
42
+ # revision identifiers, used by Alembic.
43
+ revision = "b6b09f414fe8"
44
+ down_revision = "44c91d82d419"
45
+ branch_labels = None
46
+ depends_on = None
47
+
48
+
49
+ def upgrade() -> None:
50
+ """Upgrade."""
51
+ schema = config["schema"]
52
+
53
+ # names are required
54
+ op.alter_column("dimension", "name", existing_type=sa.VARCHAR(), nullable=False, schema=schema)
55
+ op.alter_column("interface", "name", existing_type=sa.VARCHAR(), nullable=False, schema=schema)
56
+ op.alter_column("restrictionarea", "name", existing_type=sa.VARCHAR(), nullable=False, schema=schema)
57
+ # Set a default value to boolean ind int
58
+ op.execute(f"UPDATE {schema}.layer SET public = true WHERE public IS NULL")
59
+ op.alter_column("layer", "public", existing_type=sa.BOOLEAN(), nullable=False, schema=schema)
60
+ op.execute(f"UPDATE {schema}.layergroup_treeitem SET ordering = 0 WHERE ordering IS NULL")
61
+ op.alter_column(
62
+ "layergroup_treeitem", "ordering", existing_type=sa.INTEGER(), nullable=False, schema=schema
63
+ )
64
+ op.alter_column("metadata", "name", existing_type=sa.VARCHAR(), nullable=False, schema=schema)
65
+ op.execute(f"UPDATE {schema}.ogc_server SET wfs_support = false WHERE wfs_support IS NULL")
66
+ op.alter_column(
67
+ "ogc_server",
68
+ "wfs_support",
69
+ existing_type=sa.BOOLEAN(),
70
+ nullable=False,
71
+ existing_server_default="false",
72
+ schema=schema,
73
+ )
74
+ op.execute(f"UPDATE {schema}.ogc_server SET is_single_tile = false WHERE is_single_tile IS NULL")
75
+ op.alter_column(
76
+ "ogc_server",
77
+ "is_single_tile",
78
+ existing_type=sa.BOOLEAN(),
79
+ nullable=False,
80
+ existing_server_default="false",
81
+ schema=schema,
82
+ )
83
+ op.execute(f"UPDATE {schema}.restrictionarea SET readwrite = false WHERE readwrite IS NULL")
84
+ op.alter_column("restrictionarea", "readwrite", existing_type=sa.BOOLEAN(), nullable=False, schema=schema)
85
+ # Add missing index
86
+ # Remove it if he al ready exists
87
+ connection = op.get_bind()
88
+ if op.get_context().dialect.has_index(
89
+ connection,
90
+ index_name="idx_restrictionarea_area",
91
+ table_name="restrictionarea",
92
+ schema=schema,
93
+ ):
94
+ op.drop_index(
95
+ "idx_restrictionarea_area", table_name="restrictionarea", schema=schema, postgresql_using="gist"
96
+ )
97
+
98
+ op.create_index(
99
+ "idx_restrictionarea_area",
100
+ "restrictionarea",
101
+ ["area"],
102
+ unique=False,
103
+ schema=schema,
104
+ postgresql_using="gist",
105
+ )
106
+ # label is required
107
+ op.alter_column("tsearch", "label", existing_type=sa.VARCHAR(), nullable=False, schema=schema)
108
+ # Add default value
109
+ op.execute(f"UPDATE {schema}.tsearch SET public = true WHERE public IS NULL")
110
+ op.alter_column(
111
+ "tsearch",
112
+ "public",
113
+ existing_type=sa.BOOLEAN(),
114
+ nullable=False,
115
+ existing_server_default="true",
116
+ schema=schema,
117
+ )
118
+ op.execute(f"UPDATE {schema}.tsearch SET from_theme = false WHERE from_theme IS NULL")
119
+ op.alter_column(
120
+ "tsearch",
121
+ "from_theme",
122
+ existing_type=sa.BOOLEAN(),
123
+ nullable=False,
124
+ existing_server_default="false",
125
+ schema=schema,
126
+ )
127
+
128
+
129
+ def downgrade() -> None:
130
+ """Downgrade."""
131
+ schema = config["schema"]
132
+
133
+ op.alter_column(
134
+ "tsearch",
135
+ "from_theme",
136
+ existing_type=sa.BOOLEAN(),
137
+ nullable=True,
138
+ existing_server_default="false",
139
+ schema=schema,
140
+ )
141
+ op.alter_column(
142
+ "tsearch",
143
+ "public",
144
+ existing_type=sa.BOOLEAN(),
145
+ nullable=True,
146
+ existing_server_default="true",
147
+ schema=schema,
148
+ )
149
+ op.alter_column("tsearch", "label", existing_type=sa.VARCHAR(), nullable=True, schema=schema)
150
+ op.alter_column("restrictionarea", "readwrite", existing_type=sa.BOOLEAN(), nullable=True, schema=schema)
151
+ op.alter_column("restrictionarea", "name", existing_type=sa.VARCHAR(), nullable=True, schema=schema)
152
+ op.alter_column(
153
+ "ogc_server",
154
+ "is_single_tile",
155
+ existing_type=sa.BOOLEAN(),
156
+ nullable=True,
157
+ existing_server_default="false",
158
+ schema=schema,
159
+ )
160
+ op.alter_column(
161
+ "ogc_server",
162
+ "wfs_support",
163
+ existing_type=sa.BOOLEAN(),
164
+ nullable=True,
165
+ existing_server_default="false",
166
+ schema=schema,
167
+ )
168
+ op.alter_column("metadata", "name", existing_type=sa.VARCHAR(), nullable=True, schema=schema)
169
+ op.alter_column(
170
+ "layergroup_treeitem", "ordering", existing_type=sa.INTEGER(), nullable=True, schema=schema
171
+ )
172
+ op.alter_column("layer", "public", existing_type=sa.BOOLEAN(), nullable=True, schema=schema)
173
+ op.alter_column("interface", "name", existing_type=sa.VARCHAR(), nullable=True, schema=schema)
174
+ op.alter_column("dimension", "name", existing_type=sa.VARCHAR(), nullable=True, schema=schema)
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2019-2021, Camptocamp SA
1
+ # Copyright (c) 2019-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  Remove deprecated columns.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2017-2021, Camptocamp SA
1
+ # Copyright (c) 2017-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  Change mapserver URL for Docker.
@@ -51,13 +51,11 @@ def upgrade() -> None:
51
51
 
52
52
  # Instructions
53
53
  op.execute(
54
- """
54
+ f"""
55
55
  UPDATE "{schema}".ogc_server
56
56
  SET url = 'config://mapserver'
57
57
  WHERE url = 'config://internal/mapserv'
58
- """.format(
59
- schema=schema
60
- )
58
+ """
61
59
  )
62
60
 
63
61
 
@@ -67,11 +65,9 @@ def downgrade() -> None:
67
65
 
68
66
  # Instructions
69
67
  op.execute(
70
- """
68
+ f"""
71
69
  UPDATE "{schema}".ogc_server
72
70
  SET url = 'config://internal/mapserv'
73
71
  WHERE url = 'config://mapserver'
74
- """.format(
75
- schema=schema
76
- )
72
+ """
77
73
  )
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2017-2019, Camptocamp SA
1
+ # Copyright (c) 2017-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  Be able to delete a linked functionality.
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2016-2019, Camptocamp SA
1
+ # Copyright (c) 2016-2025, Camptocamp SA
4
2
  # All rights reserved.
5
3
 
6
4
  # Redistribution and use in source and binary forms, with or without
@@ -27,7 +25,7 @@
27
25
  # of the authors and should not be interpreted as representing official policies,
28
26
  # either expressed or implied, of the FreeBSD Project.
29
27
 
30
- # pylint: disable=no-member
28
+ # pylint: disable=invalid-name
31
29
 
32
30
  """
33
31
  Merge 2.0 and master branches.