~qeef/damn-deploy

aca168eccf51784f37030c92d52d90ae2d7295a8 — Jiri Vlasak 2 months ago 87cdf3a + 9383a52
Merge branch 'instantly-delete-archived-areas'
3 files changed, 32 insertions(+), 0 deletions(-)

M CHANGELOG.md
M README.md
A upkeep/scripts/delete_areas_with_priority_-10.sql
M CHANGELOG.md => CHANGELOG.md +5 -0
@@ 12,6 12,11 @@ The format is based on [Keep a Changelog][] and this project adheres to
Unreleased
==========

Added
-----

- Upkeep script to delete archived areas with priority `-10`.


0.9.4 - 2020-11-29
==================

M README.md => README.md +24 -0
@@ 345,3 345,27 @@ hours.
       systemctl enable damn_upkeep.service

       systemctl start damn_upkeep.timer

Automatically unlock square
---------------------------

The `unlock_square.sql` upkeep script unlocks a square that is locked for more
than two hours.

Update areas statistics
-----------------------

The `update_areas_statistics.sql` script updates *squares to map*, *squares to
review* and *squares done* fields of all *current* areas (areas with a priority
greater than zero.)

Delete archived areas
---------------------

When an area has priority `-10`, the `delete_areas_with_priority_-10.sql`
script deletes such an area including all its squares and commits during the
upkeep.

**NOTE:** It works only for the areas with priority `-10`. For other archived
areas (areas with priority less than zero,) there is no special upkeep script
yet.

A upkeep/scripts/delete_areas_with_priority_-10.sql => upkeep/scripts/delete_areas_with_priority_-10.sql +3 -0
@@ 0,0 1,3 @@
DELETE FROM current_commits cc USING current_areas ca WHERE ca.aid = cc.aid AND ca.priority=-10;
DELETE FROM current_squares cs USING current_areas ca WHERE ca.aid = cs.aid AND ca.priority=-10;
DELETE FROM current_areas ca WHERE ca.priority=-10;