Skip to content

Instantly share code, notes, and snippets.

@signedav
Last active January 31, 2019 09:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save signedav/292d1da243d091f29dbf2e5f7590ff4a to your computer and use it in GitHub Desktop.
Save signedav/292d1da243d091f29dbf2e5f7590ff4a to your computer and use it in GitHub Desktop.
trigger logic

cover on INSERT

take level (even when NULL or nothing) as Z

wastewater_node on INSERT

take bottom level (even when NULL or nothing) as Z

reach and reach_point on INSERT

take level of reach_point (even when NULL or nothing) as Z of reach_point and reach

cover ON UPDATE

if level changed, take level as Z / if not: if Z changed, take Z as level

wastewater_node on UPDATE

if bottom_level changed, take bottom_level as Z / if not: if Z changed, take Z as bottom_level

reach and reach_point on UPDATE

if level of reach_point changed, take level as Z of reach_point and reach / if not: if Z changed, take Z as level of reach_point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment