-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocumentation cron postgresql.txt
executable file
·58 lines (56 loc) · 2.03 KB
/
documentation cron postgresql.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{\rtf1\ansi\ansicpg1252\cocoartf2580
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fnil\fcharset0 Menlo-Regular;\f1\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;}
{\*\expandedcolortbl;;\csgray\c0;}
\paperw11900\paperh16840\margl1440\margr1440\vieww11520\viewh12480\viewkind0
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0
\f0\fs22 \cf2 \CocoaLigature0 \
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
\f1\fs24 \cf0 \CocoaLigature1 \'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\
\
\pard\pardeftab720\partightenfactor0
\cf0 \
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
\cf0 SELECT cron.schedule('*/10 * * * *', $$\
UPDATE reports\
SET metersfromgroundzero = earth_distance(\
ll_to_earth(airdrips.latitude, airdrips.longitude),\
ll_to_earth(reports.latitude, reports.longitude)\
)\
FROM airdrops\
WHERE reports.report_id = airdrips.report_id AND airdrips.latitude IS NOT NULL AND reports.metersfromgroundzero IS NULL$$);\
\
\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\
\
\
\
\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\
\
\
SELECT cron.schedule('* * * * *', \
$$UPDATE reports\
SET status = true\
WHERE report_id IN (\
SELECT report_id\
FROM reports\
WHERE metersfromgroundzero > 450\
GROUP BY report_id\
HAVING COUNT(*) >= 5\
)\
AND id IN (\
SELECT id\
FROM reports\
WHERE report_id IN (\
SELECT report_id\
FROM reports\
WHERE metersfromgroundzero > 450\
GROUP BY report_id\
HAVING COUNT(*) >= 5\
)\
ORDER BY report_id, created_at DESC\
OFFSET 4\
);$$);\
\
\
\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\'97\
}