2018-05-27 02:26:34 +00:00
|
|
|
|
|
|
|
-- +goose Up
|
|
|
|
-- SQL in section 'Up' is executed when this migration is applied
|
2018-12-27 16:23:54 +00:00
|
|
|
ALTER TABLE `results` ADD COLUMN modified_date DATETIME;
|
2018-05-27 02:26:34 +00:00
|
|
|
|
2018-12-27 16:23:54 +00:00
|
|
|
UPDATE `results`
|
2018-05-27 02:26:34 +00:00
|
|
|
SET `modified_date`= (
|
|
|
|
SELECT max(events.time) FROM events
|
|
|
|
WHERE events.email=results.email
|
|
|
|
AND events.campaign_id=results.campaign_id
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- +goose Down
|
|
|
|
-- SQL section 'Down' is executed when this migration is rolled back
|
|
|
|
|