Skip to content

Commit 72f575c

Browse files
committed
fix: Trigger basex updates on gk udpates
1 parent d5257e6 commit 72f575c

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

website/db/migrations/20251015210000_merge_notifications_migrations.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ public function up(): void {
9999

100100
// 6. Add AMQP triggers for instant notifications
101101
$this->execute('
102+
CREATE TRIGGER after_99_notify_amqp_geokrety
103+
AFTER INSERT ON geokrety.gk_geokrety
104+
FOR EACH ROW EXECUTE FUNCTION notify_queues.amqp_notify_id();
105+
102106
CREATE TRIGGER after_99_notify_amqp_moves
103107
AFTER INSERT ON geokrety.gk_moves
104108
FOR EACH ROW EXECUTE FUNCTION notify_queues.amqp_notify_id();
@@ -112,6 +116,7 @@ public function up(): void {
112116
public function down(): void {
113117
// 1. Remove AMQP triggers
114118
$this->execute('
119+
DROP TRIGGER IF EXISTS after_99_notify_amqp_geokrety ON geokrety.gk_geokrety;
115120
DROP TRIGGER IF EXISTS after_99_notify_amqp_moves ON geokrety.gk_moves;
116121
DROP TRIGGER IF EXISTS after_99_notify_amqp_moves_comments ON geokrety.gk_moves_comments;
117122
');

website/workers/basex-sync.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,12 @@ protected function processMessage(AMQPMessage $msg): void {
5858
$this->log(self::LOG_DEBUG, 'Message received', $data);
5959

6060
switch ($data['kind']) {
61-
// TODO?
62-
// case 'gk_geokrety':
63-
// $this->handleGeokret((int) $data['id']);
64-
// break;
65-
// TODO?
66-
// case 'gk_moves_comments':
67-
// $this->handleMoveComment((int) $data['id']);
68-
// break;
61+
case 'gk_geokrety':
62+
$this->handleGeokret((int) $data['id']);
63+
break;
64+
case 'gk_moves_comments':
65+
$this->handleMoveComment((int) $data['id']);
66+
break;
6967
case 'gk_moves':
7068
$this->handleMove((int) $data['id']);
7169
break;

0 commit comments

Comments
 (0)