diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 27c06cfb3..cd2acf005 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -90,7 +90,7 @@ repos: rev: 23.7.0 hooks: - id: black - language_version: python3.9.2 + language_version: python3 - repo: https://github.com/PyCQA/flake8 rev: 6.0.0 hooks: diff --git a/backend/migrations/2023-08-08-200334_add_missing_shade_layers/down.sql b/backend/migrations/2023-08-08-200334_add_missing_shade_layers/down.sql new file mode 100644 index 000000000..cce261b49 --- /dev/null +++ b/backend/migrations/2023-08-08-200334_add_missing_shade_layers/down.sql @@ -0,0 +1 @@ +-- This migration can not be undone! diff --git a/backend/migrations/2023-08-08-200334_add_missing_shade_layers/up.sql b/backend/migrations/2023-08-08-200334_add_missing_shade_layers/up.sql new file mode 100644 index 000000000..51e34c770 --- /dev/null +++ b/backend/migrations/2023-08-08-200334_add_missing_shade_layers/up.sql @@ -0,0 +1,17 @@ +INSERT INTO layers (map_id, type, name, is_alternative) +SELECT + maps_without_shade_layer.id AS map_id, + 'shade' AS type, -- noqa: RF04 + 'Shade Layer' AS name, -- noqa: RF04 + false AS is_alternative +FROM ( + SELECT maps.id AS id + FROM maps + + EXCEPT + + SELECT maps.id + FROM maps + LEFT JOIN layers ON layers.map_id = maps.id + WHERE layers.type = 'shade' +) AS maps_without_shade_layer;