-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to migrate events from archive to the weekend table. Also …
…add job_id to the events view.
- Loading branch information
1 parent
6062b0e
commit b206624
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
SET @start_date := '2012-08-10 01:37:00'; | ||
SET @end_date := '2012-08-13 12:33:00'; | ||
|
||
DROP VIEW IF EXISTS events; | ||
CREATE VIEW events AS | ||
SELECT a.event_id as id, | ||
a.email, | ||
m.category, | ||
a.event_type, | ||
m.mailing_id, | ||
a.job_id, | ||
a.queue_id, | ||
i.name as instance, | ||
i.install_class, | ||
i.servername, | ||
a.result, | ||
a.dt_created, | ||
a.dt_received, | ||
a.dt_processed, | ||
a.is_test | ||
FROM archive a | ||
JOIN message m ON a.message_id=m.id | ||
JOIN instance i ON m.instance_id=i.id; | ||
|
||
BEGIN; | ||
|
||
INSERT INTO weekend_events | ||
(email, category, event_type, mailing_id, job_id, queue_id, instance, install_class, servername, dt_created, dt_received, is_test) | ||
SELECT | ||
email, category, event_type, mailing_id, job_id, queue_id, instance, install_class, servername, dt_created, dt_received, is_test | ||
FROM events WHERE dt_processed > @start_date AND dt_processed < @end_date; | ||
|
||
DELETE FROM archive WHERE dt_processed > @start_date AND dt_processed < @end_date; | ||
|
||
COMMIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters