Files
adsPRO/migrations/019_campaign_alerts_product_id.sql
Jacek Pyziak 167ced3573 feat: Enhance user settings with cron URL plan display
- Added a new field to display the cron URL plan in user settings.
- Updated JavaScript to handle the new plan data.

refactor: Unify product model and migrate data

- Migrated product data from `products_data` to `products` table.
- Added new columns to `products` for better data organization.
- Created `products_aggregate` table for storing aggregated product metrics.

chore: Drop deprecated products_data table

- Removed `products_data` table as data is now stored in `products`.

feat: Add merchant URL flags to products

- Introduced flags for tracking merchant URL status in `products` table.
- Normalized product URLs to handle empty or invalid values.

feat: Link campaign alerts to specific products

- Added `product_id` column to `campaign_alerts` table for better tracking.
- Created an index for efficient querying of alerts by product.

chore: Add debug scripts for client data inspection

- Created debug scripts to inspect client data from local and remote databases.
- Included error handling and output formatting for better readability.
2026-02-20 17:50:14 +01:00

32 lines
782 B
SQL

-- Powiazanie alertow z konkretnym produktem
SET @sql = IF(
EXISTS (
SELECT 1
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'campaign_alerts'
AND COLUMN_NAME = 'product_id'
),
'DO 1',
'ALTER TABLE `campaign_alerts` ADD COLUMN `product_id` INT(11) NULL DEFAULT NULL AFTER `ad_group_external_id`'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @sql = IF(
EXISTS (
SELECT 1
FROM INFORMATION_SCHEMA.STATISTICS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'campaign_alerts'
AND INDEX_NAME = 'idx_alert_product'
),
'DO 1',
'CREATE INDEX `idx_alert_product` ON `campaign_alerts` (`product_id`)'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;