DB 변경 생길 때마다 알림 주기 - MySQL trigger, flutter cron
GPT To receive notifications when a change occurs in the user's schedule value in the database, you can implement several approaches depending on your specific needs and the technologies you're comfortable with. Here’s a high-level overview of the options: 1. Polling (Active Checking) How it works: You can create a script that periodically checks the database for changes. If a change is detected, the script sends a notification. Steps: Set up a CRON job (or Windows Task Scheduler if on Windows) that runs a script every X minutes. The script queries the database for changes in the user's schedule value. If a change is detected, send a notification (e.g., via email, SMS, or push notification). Pros: Easy to implement. Cons: Not real-time, may introduce unnecessary load on the server if the polling frequency is too high. 2. Database Triggers + Notification System How it works: Use a database trigger to detect changes and invoke a notification system. Steps: Create a Trigger: Set up a trigger in your MySQL database (if you're using MySQL with XAMPP) that activates when a change occurs in the user's schedule table. Trigger Action: The trigger could insert a record into a separate "notifications" table or call an external script to send a notification. Notification System: Use a script or service (such as an email or SMS API) to send notifications when new records are added to the "notifications" table. Pros: Real-time notifications, less overhead than polling. Cons: More complex setup, requires database-level modifications. Example of a MySQL trigger: 3. WebSocket or Server-Sent Events (SSE)