c2cgeoportal-commons 2.5.0.100__py3-none-any.whl → 2.9rc44__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.

Potentially problematic release.


This version of c2cgeoportal-commons might be problematic. Click here for more details.

Files changed (92) hide show
  1. c2cgeoportal_commons/__init__.py +2 -5
  2. c2cgeoportal_commons/alembic/env.py +52 -33
  3. c2cgeoportal_commons/alembic/main/028477929d13_add_technical_roles.py +10 -7
  4. c2cgeoportal_commons/alembic/main/04f05bfbb05e_remove_the_old_is_expanded_column.py +62 -0
  5. c2cgeoportal_commons/alembic/main/116b9b79fc4d_internal_and_external_layer_tables_.py +42 -43
  6. c2cgeoportal_commons/alembic/main/1418cb05921b_merge_1_6_and_master_branches.py +9 -8
  7. c2cgeoportal_commons/alembic/main/164ac0819a61_add_image_format_to_wmts_layer.py +9 -6
  8. c2cgeoportal_commons/alembic/main/166ff2dcc48d_create_database.py +22 -25
  9. c2cgeoportal_commons/alembic/main/16e43f8c0330_remove_old_metadata_column.py +9 -6
  10. c2cgeoportal_commons/alembic/main/1d5d4abfebd1_add_restricted_theme.py +14 -8
  11. c2cgeoportal_commons/alembic/main/1de20166b274_remove_v1_artifacts.py +9 -6
  12. c2cgeoportal_commons/alembic/main/20137477bd02_update_icons_url.py +9 -6
  13. c2cgeoportal_commons/alembic/main/21f11066f8ec_trigger_on_role_updates_user_in_static.py +21 -20
  14. c2cgeoportal_commons/alembic/main/22e6dfb556de_add_description_tree_.py +9 -6
  15. c2cgeoportal_commons/alembic/main/29f2a32859ec_merge_1_6_and_master_branches.py +9 -8
  16. c2cgeoportal_commons/alembic/main/2b8ed8c1df94_set_layergroup_treeitem_is_as_a_primary_.py +9 -6
  17. c2cgeoportal_commons/alembic/main/2e57710fecfe_update_the_ogc_server_for_ogc_api.py +71 -0
  18. c2cgeoportal_commons/alembic/main/32527659d57b_move_exclude_properties_from_layerv1_to_.py +15 -12
  19. c2cgeoportal_commons/alembic/main/32b21aa1d0ed_merge_e004f76e951a_and_e004f76e951a_.py +9 -8
  20. c2cgeoportal_commons/alembic/main/338b57593823_remove_trigger_on_role_name_change.py +25 -24
  21. c2cgeoportal_commons/alembic/main/415746eb9f6_changes_for_v2.py +45 -43
  22. c2cgeoportal_commons/alembic/main/44c91d82d419_add_table_log.py +72 -0
  23. c2cgeoportal_commons/alembic/main/5109242131ce_add_column_time_widget.py +11 -9
  24. c2cgeoportal_commons/alembic/main/52916d8fde8b_add_sql_fields_to_vector_tiles.py +60 -0
  25. c2cgeoportal_commons/alembic/main/53ba1a68d5fe_add_theme_to_fulltextsearch.py +9 -6
  26. c2cgeoportal_commons/alembic/main/54645a535ad6_add_ordering_in_relation.py +17 -14
  27. c2cgeoportal_commons/alembic/main/56dc90838d90_fix_removing_layerv1.py +10 -8
  28. c2cgeoportal_commons/alembic/main/596ba21e3833_separate_local_internal.py +13 -14
  29. c2cgeoportal_commons/alembic/main/678f88c7ad5e_add_vector_tiles_layers_table.py +9 -6
  30. c2cgeoportal_commons/alembic/main/6a412d9437b1_rename_serverogc_to_ogcserver.py +9 -6
  31. c2cgeoportal_commons/alembic/main/6d87fdad275a_convert_metadata_to_the_right_case.py +13 -20
  32. c2cgeoportal_commons/alembic/main/7530011a66a7_trigger_on_role_updates_user_in_static.py +21 -20
  33. c2cgeoportal_commons/alembic/main/78fd093c8393_add_api_s_intrfaces.py +36 -52
  34. c2cgeoportal_commons/alembic/main/7d271f4527cd_add_layer_column_in_layerv1_table.py +9 -6
  35. c2cgeoportal_commons/alembic/main/809650bd04c3_add_dimension_field.py +9 -6
  36. c2cgeoportal_commons/alembic/main/8117bb9bba16_use_dimension_on_all_the_layers.py +9 -6
  37. c2cgeoportal_commons/alembic/main/87f8330ed64e_add_missing_delete_cascades.py +305 -0
  38. c2cgeoportal_commons/alembic/main/9268a1dffac0_add_trigger_to_be_able_to_correctly_.py +11 -8
  39. c2cgeoportal_commons/alembic/main/94db7e7e5b21_merge_2_2_and_master_branches.py +9 -8
  40. c2cgeoportal_commons/alembic/main/951ff84bd8ec_be_able_to_delete_a_wms_layer_in_sql.py +9 -6
  41. c2cgeoportal_commons/alembic/main/a00109812f89_add_field_layer_wms_valid.py +60 -0
  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 +9 -8
  44. c2cgeoportal_commons/alembic/main/b60f2a505f42_remame_uimetadata_to_metadata.py +9 -6
  45. c2cgeoportal_commons/alembic/main/b6b09f414fe8_sync_model_database.py +165 -0
  46. c2cgeoportal_commons/alembic/main/c75124553bf3_remove_deprecated_columns.py +9 -6
  47. c2cgeoportal_commons/alembic/main/d48a63b348f1_change_mapserver_url_for_docker.py +13 -14
  48. c2cgeoportal_commons/alembic/main/d8ef99bc227e_be_able_to_delete_a_linked_functionality.py +16 -13
  49. c2cgeoportal_commons/alembic/main/daf738d5bae4_merge_2_0_and_master_branches.py +9 -8
  50. c2cgeoportal_commons/alembic/main/dba87f2647f9_merge_2_2_on_2_3.py +9 -8
  51. c2cgeoportal_commons/alembic/main/e004f76e951a_add_missing_not_null.py +15 -32
  52. c2cgeoportal_commons/alembic/main/e7e03dedade3_put_the_default_wms_server_in_the_.py +13 -14
  53. c2cgeoportal_commons/alembic/main/e85afd327ab3_cascade_deletes_to_tsearch.py +9 -6
  54. c2cgeoportal_commons/alembic/main/ec82a8906649_add_missing_on_delete_cascade_on_layer_.py +13 -10
  55. c2cgeoportal_commons/alembic/main/ee25d267bf46_main_interface_desktop.py +11 -14
  56. c2cgeoportal_commons/alembic/main/eeb345672454_merge_2_4_and_master_branches.py +9 -8
  57. c2cgeoportal_commons/alembic/static/0c640a58a09a_add_opt_key_column.py +9 -6
  58. c2cgeoportal_commons/alembic/static/107b81f5b9fe_add_missing_delete_cascades.py +78 -0
  59. c2cgeoportal_commons/alembic/static/1857owc78a07_add_last_login_and_expiration_date.py +7 -6
  60. c2cgeoportal_commons/alembic/static/1da396a88908_move_user_table_to_static_schema.py +19 -20
  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 +8 -7
  63. c2cgeoportal_commons/alembic/static/44c91d82d419_add_table_log.py +72 -0
  64. c2cgeoportal_commons/alembic/static/53d671b17b20_add_timezone_on_datetime_fields.py +9 -6
  65. c2cgeoportal_commons/alembic/static/5472fbc19f39_add_temp_password_column.py +9 -6
  66. c2cgeoportal_commons/alembic/static/76d72fb3fcb9_add_oauth2_pkce.py +70 -0
  67. c2cgeoportal_commons/alembic/static/7ef947f30f20_add_oauth2_tables.py +115 -0
  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 +15 -18
  71. c2cgeoportal_commons/alembic/static/bd029dbfc11a_fill_tech_data_column.py +10 -8
  72. c2cgeoportal_commons/lib/email_.py +16 -18
  73. c2cgeoportal_commons/lib/literal.py +44 -0
  74. c2cgeoportal_commons/lib/url.py +221 -0
  75. c2cgeoportal_commons/lib/validators.py +2 -4
  76. c2cgeoportal_commons/models/__init__.py +19 -15
  77. c2cgeoportal_commons/models/main.py +1268 -266
  78. c2cgeoportal_commons/models/sqlalchemy.py +15 -19
  79. c2cgeoportal_commons/models/static.py +338 -63
  80. c2cgeoportal_commons/py.typed +0 -0
  81. c2cgeoportal_commons/testing/__init__.py +18 -13
  82. c2cgeoportal_commons/testing/initializedb.py +15 -14
  83. {c2cgeoportal_commons-2.5.0.100.dist-info → c2cgeoportal_commons-2.9rc44.dist-info}/METADATA +18 -23
  84. c2cgeoportal_commons-2.9rc44.dist-info/RECORD +89 -0
  85. {c2cgeoportal_commons-2.5.0.100.dist-info → c2cgeoportal_commons-2.9rc44.dist-info}/WHEEL +1 -1
  86. tests/conftest.py +4 -6
  87. c2cgeoportal_commons-2.5.0.100.dist-info/RECORD +0 -75
  88. tests/test_interface.py +0 -27
  89. tests/test_roles.py +0 -63
  90. tests/test_users.py +0 -71
  91. tests/test_validators.py +0 -20
  92. {c2cgeoportal_commons-2.5.0.100.dist-info → c2cgeoportal_commons-2.9rc44.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2017, Camptocamp SA
1
+ # Copyright (c) 2017-2024, 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,10 @@
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
- """Convert the metadata to the right case
28
+ # pylint: disable=no-member,invalid-name
29
+
30
+ """
31
+ Convert the metadata to the right case.
31
32
 
32
33
  Revision ID: 6d87fdad275a
33
34
  Revises: 9268a1dffac0
@@ -44,29 +45,21 @@ branch_labels = None
44
45
  depends_on = None
45
46
 
46
47
 
47
- def upgrade():
48
+ def upgrade() -> None:
49
+ """Upgrade."""
48
50
  schema = config["schema"]
49
51
 
52
+ op.execute(f"UPDATE ONLY {schema}.metadata SET name = 'copyTo' where name = 'copy_to'")
50
53
  op.execute(
51
- "UPDATE ONLY {schema}.metadata SET name = 'copyTo' where name = 'copy_to'".format(schema=schema)
54
+ f"UPDATE ONLY {schema}.metadata SET name = 'geometryValidation' where name = 'geometry_validation'"
52
55
  )
53
- # fmt: off
54
- op.execute(
55
- "UPDATE ONLY {schema}.metadata SET name = 'geometryValidation' where name = 'geometry_validation'"
56
- .format(schema=schema)
57
- )
58
- # fmt: on
59
56
 
60
57
 
61
- def downgrade():
58
+ def downgrade() -> None:
59
+ """Downgrade."""
62
60
  schema = config["schema"]
63
61
 
62
+ op.execute(f"UPDATE ONLY {schema}.metadata SET name = 'copy_to' where name = 'copyTo'")
64
63
  op.execute(
65
- "UPDATE ONLY {schema}.metadata SET name = 'copy_to' where name = 'copyTo'".format(schema=schema)
66
- )
67
- # fmt: off
68
- op.execute(
69
- "UPDATE ONLY {schema}.metadata SET name = 'geometry_validation' where name = 'geometryValidation'"
70
- .format(schema=schema)
64
+ f"UPDATE ONLY {schema}.metadata SET name = 'geometry_validation' where name = 'geometryValidation'"
71
65
  )
72
- # fmt: on
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2018-2019, Camptocamp SA
1
+ # Copyright (c) 2018-2024, 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,10 @@
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
- """trigger_on_role_updates_user_in_static
28
+ # pylint: disable=no-member,invalid-name
29
+
30
+ """
31
+ trigger_on_role_updates_user_in_static.
31
32
 
32
33
  Revision ID: 7530011a66a7
33
34
  Revises: d8ef99bc227e
@@ -44,29 +45,29 @@ branch_labels = None
44
45
  depends_on = None
45
46
 
46
47
 
47
- def upgrade():
48
+ def upgrade() -> None:
49
+ """Upgrade."""
48
50
  schema = config["schema"]
49
51
  staticschema = config["schema_static"]
50
52
 
51
53
  op.execute(
52
- """
53
- CREATE OR REPLACE FUNCTION {schema}.on_role_name_change()
54
- RETURNS trigger AS
55
- $$
56
- BEGIN
57
- IF NEW.name <> OLD.name THEN
58
- UPDATE {staticschema}."user" SET role_name = NEW.name WHERE role_name = OLD.name;
59
- END IF;
60
- RETURN NEW;
61
- END;
62
- $$
63
- LANGUAGE plpgsql""".format(
64
- schema=schema, staticschema=staticschema
65
- )
54
+ f"""
55
+ CREATE OR REPLACE FUNCTION {schema}.on_role_name_change()
56
+ RETURNS trigger AS
57
+ $$
58
+ BEGIN
59
+ IF NEW.name <> OLD.name THEN
60
+ UPDATE {staticschema}."user" SET role_name = NEW.name WHERE role_name = OLD.name;
61
+ END IF;
62
+ RETURN NEW;
63
+ END;
64
+ $$
65
+ LANGUAGE plpgsql"""
66
66
  )
67
67
 
68
68
 
69
- def downgrade():
69
+ def downgrade() -> None:
70
+ """Downgrade."""
70
71
  schema = config["schema"]
71
72
 
72
73
  op.execute(
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2019, Camptocamp SA
1
+ # Copyright (c) 2019-2024, Camptocamp SA
4
2
  # All rights reserved.
5
3
 
6
4
  # Redistribution and use in source and binary forms, with or without
@@ -27,13 +25,17 @@
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
- """Add API's intrfaces
28
+ # pylint: disable=no-member,invalid-name
29
+
30
+ """
31
+ Add API's interfaces.
31
32
 
32
33
  Revision ID: 78fd093c8393
33
34
  Revises: e85afd327ab3
34
35
  Create Date: 2019-08-29 07:56:15.547216
35
36
  """
36
37
 
38
+ import sqlalchemy
37
39
  from alembic import op
38
40
  from c2c.template.config import config
39
41
  from sqlalchemy import Column, MetaData, Table
@@ -46,7 +48,8 @@ branch_labels = None
46
48
  depends_on = None
47
49
 
48
50
 
49
- def upgrade():
51
+ def upgrade() -> None:
52
+ """Upgrade."""
50
53
  schema = config["schema"]
51
54
 
52
55
  # Instructions
@@ -54,41 +57,32 @@ def upgrade():
54
57
  connection = op.get_bind()
55
58
  for interface_name in ("api", "iframe_api"):
56
59
  result = connection.execute(
57
- "SELECT count(name) FROM {schema}.interface WHERE name='{name}'".format(
58
- name=interface_name, schema=schema
59
- )
60
+ sqlalchemy.text(f"SELECT count(name) FROM {schema}.interface WHERE name=:interface_name"),
61
+ {"interface_name": interface_name},
60
62
  )
61
- if result.fetchone()[0] == 0:
63
+ if result.fetchone()[0] == 0: # type: ignore[index]
62
64
  op.bulk_insert(interface, [{"name": interface_name}])
63
65
  for interface_name in ("edit", "routing"):
64
66
  result = connection.execute(
65
- "SELECT count(name) FROM {schema}.interface WHERE name='{name}'".format(
66
- name=interface_name, schema=schema
67
- )
67
+ sqlalchemy.text(f"SELECT count(name) FROM {schema}.interface WHERE name=:interface_name"),
68
+ {"interface_name": interface_name},
68
69
  )
69
- if result.fetchone()[0] != 0:
70
+ if result.fetchone()[0] != 0: # type: ignore[index]
70
71
  op.execute(
71
- "DELETE FROM {schema}.interface_theme it "
72
- "USING {schema}.interface i "
73
- "WHERE it.interface_id = i.id AND i.name = '{name}'".format(
74
- name=interface_name, schema=schema
75
- )
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}'"
76
75
  )
77
76
  op.execute(
78
- "DELETE FROM {schema}.interface_layer il "
79
- "USING {schema}.interface i "
80
- "WHERE il.interface_id = i.id AND i.name = '{name}'".format(
81
- name=interface_name, schema=schema
82
- )
83
- )
84
- op.execute(
85
- "DELETE FROM {schema}.interface WHERE name='{name}'".format(
86
- name=interface_name, schema=schema
87
- )
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}'"
88
80
  )
81
+ op.execute(f"DELETE FROM {schema}.interface WHERE name='{interface_name}'")
89
82
 
90
83
 
91
- def downgrade():
84
+ def downgrade() -> None:
85
+ """Downgrade."""
92
86
  schema = config["schema"]
93
87
 
94
88
  # Instructions
@@ -96,35 +90,25 @@ def downgrade():
96
90
  connection = op.get_bind()
97
91
  for interface_name in ("edit", "routing"):
98
92
  result = connection.execute(
99
- "SELECT count(name) FROM {schema}.interface WHERE name='{name}'".format(
100
- name=interface_name, schema=schema
101
- )
93
+ sqlalchemy.text(f"SELECT count(name) FROM {schema}.interface WHERE name=:interface_name"),
94
+ {"interface_name": interface_name},
102
95
  )
103
- if result.fetchone()[0] == 0:
96
+ if result.fetchone()[0] == 0: # type: ignore[index]
104
97
  op.bulk_insert(interface, [{"name": interface_name}])
105
98
  for interface_name in ("api", "iframe_api"):
106
99
  result = connection.execute(
107
- "SELECT count(name) FROM {schema}.interface WHERE name='{name}'".format(
108
- name=interface_name, schema=schema
109
- )
100
+ sqlalchemy.text(f"SELECT count(name) FROM {schema}.interface WHERE name=:interface_name"),
101
+ {"interface_name": interface_name},
110
102
  )
111
- if result.fetchone()[0] != 0:
112
- op.execute(
113
- "DELETE FROM {schema}.interface_theme it "
114
- "USING {schema}.interface i "
115
- "WHERE it.interface_id = i.id AND i.name = '{name}'".format(
116
- name=interface_name, schema=schema
117
- )
118
- )
103
+ if result.fetchone()[0] != 0: # type: ignore[index]
119
104
  op.execute(
120
- "DELETE FROM {schema}.interface_layer il "
121
- "USING {schema}.interface i "
122
- "WHERE il.interface_id = i.id AND i.name = '{name}'".format(
123
- name=interface_name, schema=schema
124
- )
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}'"
125
108
  )
126
109
  op.execute(
127
- "DELETE FROM {schema}.interface WHERE name='{name}'".format(
128
- name=interface_name, schema=schema
129
- )
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}'"
130
113
  )
114
+ op.execute(f"DELETE FROM {schema}.interface WHERE name='{interface_name}'")
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2016-2019, Camptocamp SA
1
+ # Copyright (c) 2016-2024, 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,10 @@
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
- """Add layer column in layerv1 table
28
+ # pylint: disable=no-member,invalid-name
29
+
30
+ """
31
+ Add layer column in layerv1 table.
31
32
 
32
33
  Revision ID: 7d271f4527cd
33
34
  Revises: 8117bb9bba16
@@ -46,7 +47,8 @@ branch_labels = None
46
47
  depends_on = None
47
48
 
48
49
 
49
- def upgrade():
50
+ def upgrade() -> None:
51
+ """Upgrade."""
50
52
  schema = config["schema"]
51
53
 
52
54
  op.add_column("layerv1", Column("layer", Unicode), schema=schema)
@@ -58,7 +60,8 @@ def upgrade():
58
60
  )
59
61
 
60
62
 
61
- def downgrade():
63
+ def downgrade() -> None:
64
+ """Downgrade."""
62
65
  schema = config["schema"]
63
66
 
64
67
  op.drop_column("layerv1", "layer", schema=schema)
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2018-2019, Camptocamp SA
1
+ # Copyright (c) 2018-2024, 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,10 @@
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
- """Add dimension field
28
+ # pylint: disable=no-member,invalid-name
29
+
30
+ """
31
+ Add dimension field.
31
32
 
32
33
  Revision ID: 809650bd04c3
33
34
  Revises: d8ef99bc227e
@@ -46,13 +47,15 @@ branch_labels = None
46
47
  depends_on = None
47
48
 
48
49
 
49
- def upgrade():
50
+ def upgrade() -> None:
51
+ """Upgrade."""
50
52
  schema = config["schema"]
51
53
 
52
54
  op.add_column("dimension", Column("field", Unicode), schema=schema)
53
55
 
54
56
 
55
- def downgrade():
57
+ def downgrade() -> None:
58
+ """Downgrade."""
56
59
  schema = config["schema"]
57
60
 
58
61
  op.drop_column("dimension", "field", schema=schema)
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2016-2019, Camptocamp SA
1
+ # Copyright (c) 2016-2024, 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,10 @@
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
- """Use dimension on all the layers
28
+ # pylint: disable=no-member,invalid-name
29
+
30
+ """
31
+ Use dimension on all the layers.
31
32
 
32
33
  Revision ID: 8117bb9bba16
33
34
  Revises: daf738d5bae4
@@ -44,7 +45,8 @@ branch_labels = None
44
45
  depends_on = None
45
46
 
46
47
 
47
- def upgrade():
48
+ def upgrade() -> None:
49
+ """Upgrade."""
48
50
  schema = config["schema"]
49
51
 
50
52
  op.rename_table("wmts_dimension", "dimension", schema=schema)
@@ -59,7 +61,8 @@ def upgrade():
59
61
  )
60
62
 
61
63
 
62
- def downgrade():
64
+ def downgrade() -> None:
65
+ """Downgrade."""
63
66
  schema = config["schema"]
64
67
 
65
68
  with op.batch_alter_table("dimension", schema=schema) as table_op:
@@ -0,0 +1,305 @@
1
+ # Copyright (c) 2020-2024, 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=no-member,invalid-name
29
+
30
+ """
31
+ Add missing delete cascades.
32
+
33
+ Revision ID: 87f8330ed64e
34
+ Revises: 16e43f8c0330
35
+ Create Date: 2020-05-25 14:53:36.289305
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 = "87f8330ed64e"
44
+ down_revision = "16e43f8c0330"
45
+ branch_labels = None
46
+ depends_on = None
47
+
48
+
49
+ def upgrade() -> None:
50
+ """Upgrade."""
51
+ schema = config["schema"]
52
+
53
+ op.drop_constraint(
54
+ "interface_layer_interface_id_fkey", "interface_layer", schema=schema, type_="foreignkey"
55
+ )
56
+ op.create_foreign_key(
57
+ "interface_layer_interface_id_fkey",
58
+ "interface_layer",
59
+ "interface",
60
+ ["interface_id"],
61
+ ["id"],
62
+ source_schema=schema,
63
+ referent_schema=schema,
64
+ ondelete="CASCADE",
65
+ )
66
+
67
+ op.drop_constraint(
68
+ "interface_theme_interface_id_fkey", "interface_theme", schema=schema, type_="foreignkey"
69
+ )
70
+ op.drop_constraint("interface_theme_theme_id_fkey", "interface_theme", schema=schema, type_="foreignkey")
71
+ op.create_foreign_key(
72
+ "interface_theme_interface_id_fkey",
73
+ "interface_theme",
74
+ "interface",
75
+ ["interface_id"],
76
+ ["id"],
77
+ source_schema=schema,
78
+ referent_schema=schema,
79
+ ondelete="CASCADE",
80
+ )
81
+ op.create_foreign_key(
82
+ "interface_theme_theme_id_fkey",
83
+ "interface_theme",
84
+ "theme",
85
+ ["theme_id"],
86
+ ["id"],
87
+ source_schema=schema,
88
+ referent_schema=schema,
89
+ ondelete="CASCADE",
90
+ )
91
+
92
+ op.drop_constraint(
93
+ "layer_restrictionarea_restrictionarea_id_fkey",
94
+ "layer_restrictionarea",
95
+ schema=schema,
96
+ type_="foreignkey",
97
+ )
98
+ op.drop_constraint(
99
+ "layer_restrictionarea_layer_id_fkey", "layer_restrictionarea", schema=schema, type_="foreignkey"
100
+ )
101
+ op.create_foreign_key(
102
+ "layer_restrictionarea_layer_id_fkey",
103
+ "layer_restrictionarea",
104
+ "layer",
105
+ ["layer_id"],
106
+ ["id"],
107
+ source_schema=schema,
108
+ referent_schema=schema,
109
+ ondelete="CASCADE",
110
+ )
111
+ op.create_foreign_key(
112
+ "layer_restrictionarea_restrictionarea_id_fkey",
113
+ "layer_restrictionarea",
114
+ "restrictionarea",
115
+ ["restrictionarea_id"],
116
+ ["id"],
117
+ source_schema=schema,
118
+ referent_schema=schema,
119
+ ondelete="CASCADE",
120
+ )
121
+
122
+ op.drop_constraint(
123
+ "restricted_role_theme_theme_id_fkey", "restricted_role_theme", schema=schema, type_="foreignkey"
124
+ )
125
+ op.drop_constraint(
126
+ "restricted_role_theme_role_id_fkey", "restricted_role_theme", schema=schema, type_="foreignkey"
127
+ )
128
+ op.create_foreign_key(
129
+ "restricted_role_theme_theme_id_fkey",
130
+ "restricted_role_theme",
131
+ "theme",
132
+ ["theme_id"],
133
+ ["id"],
134
+ source_schema=schema,
135
+ referent_schema=schema,
136
+ ondelete="CASCADE",
137
+ )
138
+ op.create_foreign_key(
139
+ "restricted_role_theme_role_id_fkey",
140
+ "restricted_role_theme",
141
+ "role",
142
+ ["role_id"],
143
+ ["id"],
144
+ source_schema=schema,
145
+ referent_schema=schema,
146
+ ondelete="CASCADE",
147
+ )
148
+
149
+ op.drop_constraint(
150
+ "role_restrictionarea_role_id_fkey", "role_restrictionarea", schema=schema, type_="foreignkey"
151
+ )
152
+ op.drop_constraint(
153
+ "role_restrictionarea_restrictionarea_id_fkey",
154
+ "role_restrictionarea",
155
+ schema=schema,
156
+ type_="foreignkey",
157
+ )
158
+ op.create_foreign_key(
159
+ "role_restrictionarea_role_id_fkey",
160
+ "role_restrictionarea",
161
+ "role",
162
+ ["role_id"],
163
+ ["id"],
164
+ source_schema=schema,
165
+ referent_schema=schema,
166
+ ondelete="CASCADE",
167
+ )
168
+ op.create_foreign_key(
169
+ "role_restrictionarea_restrictionarea_id_fkey",
170
+ "role_restrictionarea",
171
+ "restrictionarea",
172
+ ["restrictionarea_id"],
173
+ ["id"],
174
+ source_schema=schema,
175
+ referent_schema=schema,
176
+ ondelete="CASCADE",
177
+ )
178
+
179
+ op.alter_column("theme", "ordering", existing_type=sa.INTEGER(), nullable=False, schema=schema)
180
+
181
+
182
+ def downgrade() -> None:
183
+ """Downgrade."""
184
+ schema = config["schema"]
185
+
186
+ op.alter_column("theme", "ordering", existing_type=sa.INTEGER(), nullable=True, schema=schema)
187
+
188
+ op.drop_constraint(
189
+ "role_restrictionarea_restrictionarea_id_fkey",
190
+ "role_restrictionarea",
191
+ schema=schema,
192
+ type_="foreignkey",
193
+ )
194
+ op.drop_constraint(
195
+ "role_restrictionarea_role_id_fkey", "role_restrictionarea", schema=schema, type_="foreignkey"
196
+ )
197
+ op.create_foreign_key(
198
+ "role_restrictionarea_restrictionarea_id_fkey",
199
+ "role_restrictionarea",
200
+ "restrictionarea",
201
+ ["restrictionarea_id"],
202
+ ["id"],
203
+ source_schema=schema,
204
+ referent_schema=schema,
205
+ )
206
+ op.create_foreign_key(
207
+ "role_restrictionarea_role_id_fkey",
208
+ "role_restrictionarea",
209
+ "role",
210
+ ["role_id"],
211
+ ["id"],
212
+ source_schema=schema,
213
+ referent_schema=schema,
214
+ )
215
+
216
+ op.drop_constraint(
217
+ "restricted_role_theme_role_id_fkey", "restricted_role_theme", schema=schema, type_="foreignkey"
218
+ )
219
+ op.drop_constraint(
220
+ "restricted_role_theme_theme_id_fkey", "restricted_role_theme", schema=schema, type_="foreignkey"
221
+ )
222
+ op.create_foreign_key(
223
+ "restricted_role_theme_role_id_fkey",
224
+ "restricted_role_theme",
225
+ "role",
226
+ ["role_id"],
227
+ ["id"],
228
+ source_schema=schema,
229
+ referent_schema=schema,
230
+ )
231
+ op.create_foreign_key(
232
+ "restricted_role_theme_theme_id_fkey",
233
+ "restricted_role_theme",
234
+ "theme",
235
+ ["theme_id"],
236
+ ["id"],
237
+ source_schema=schema,
238
+ referent_schema=schema,
239
+ )
240
+
241
+ op.alter_column("ogc_server", "name", existing_type=sa.VARCHAR(), nullable=False, schema=schema)
242
+
243
+ op.drop_constraint(
244
+ "layer_restrictionarea_layer_id_fkey", "layer_restrictionarea", schema=schema, type_="foreignkey"
245
+ )
246
+ op.drop_constraint(
247
+ "layer_restrictionarea_restrictionarea_id_fkey",
248
+ "layer_restrictionarea",
249
+ schema=schema,
250
+ type_="foreignkey",
251
+ )
252
+ op.create_foreign_key(
253
+ "layer_restrictionarea_layer_id_fkey",
254
+ "layer_restrictionarea",
255
+ "layer",
256
+ ["layer_id"],
257
+ ["id"],
258
+ source_schema=schema,
259
+ referent_schema=schema,
260
+ )
261
+ op.create_foreign_key(
262
+ "layer_restrictionarea_restrictionarea_id_fkey",
263
+ "layer_restrictionarea",
264
+ "restrictionarea",
265
+ ["restrictionarea_id"],
266
+ ["id"],
267
+ source_schema=schema,
268
+ referent_schema=schema,
269
+ )
270
+
271
+ op.drop_constraint("interface_theme_theme_id_fkey", "interface_theme", schema=schema, type_="foreignkey")
272
+ op.drop_constraint(
273
+ "interface_theme_interface_id_fkey", "interface_theme", schema=schema, type_="foreignkey"
274
+ )
275
+ op.create_foreign_key(
276
+ "interface_theme_theme_id_fkey",
277
+ "interface_theme",
278
+ "theme",
279
+ ["theme_id"],
280
+ ["id"],
281
+ source_schema=schema,
282
+ referent_schema=schema,
283
+ )
284
+ op.create_foreign_key(
285
+ "interface_theme_interface_id_fkey",
286
+ "interface_theme",
287
+ "interface",
288
+ ["interface_id"],
289
+ ["id"],
290
+ source_schema=schema,
291
+ referent_schema=schema,
292
+ )
293
+
294
+ op.drop_constraint(
295
+ "interface_layer_interface_id_fkey", "interface_layer", schema=schema, type_="foreignkey"
296
+ )
297
+ op.create_foreign_key(
298
+ "interface_layer_interface_id_fkey",
299
+ "interface_layer",
300
+ "interface",
301
+ ["interface_id"],
302
+ ["id"],
303
+ source_schema=schema,
304
+ referent_schema=schema,
305
+ )