- Introduced a new `CampaignAlerts` class for handling alerts logic. - Added database migration for `campaign_alerts` table creation. - Implemented methods for fetching, marking, and deleting alerts in the `CampaignAlerts` factory class. - Created a new view for displaying campaign alerts with filtering options. - Updated the main client view to include a badge for the number of alerts. - Enhanced sync functionality to support campaigns and products separately. - Adjusted styles for alert badges in the UI.
20 lines
861 B
SQL
20 lines
861 B
SQL
CREATE TABLE IF NOT EXISTS `campaign_alerts` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`client_id` int(11) NOT NULL,
|
|
`campaign_id` int(11) DEFAULT NULL,
|
|
`campaign_external_id` bigint(20) DEFAULT NULL,
|
|
`ad_group_id` int(11) DEFAULT NULL,
|
|
`ad_group_external_id` bigint(20) DEFAULT NULL,
|
|
`alert_type` varchar(120) NOT NULL,
|
|
`message` text NOT NULL,
|
|
`meta_json` text DEFAULT NULL,
|
|
`date_detected` date NOT NULL,
|
|
`date_add` datetime NOT NULL DEFAULT current_timestamp(),
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `uniq_alert_daily` (`client_id`,`campaign_external_id`,`ad_group_external_id`,`alert_type`,`date_detected`),
|
|
KEY `idx_alert_date` (`date_detected`),
|
|
KEY `idx_alert_client` (`client_id`),
|
|
KEY `idx_alert_campaign` (`campaign_id`),
|
|
KEY `idx_alert_ad_group` (`ad_group_id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|