Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
migrations: add shade layers for old maps
Browse files Browse the repository at this point in the history
  • Loading branch information
Moritz Schalk committed Aug 8, 2023
1 parent 32e5e98 commit e575763
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-- This migration can not be undone!
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit e575763

Please sign in to comment.