-- alembic revision 2caed45e3853

lock tables `tickets` write;
alter table `tickets` add column fire_at datetime default null;
alter table `tickets` add column ready_at datetime default null;

UPDATE `tickets` SET ready_at = DATE_ADD(ready_date, INTERVAL TIME_TO_SEC(ready_time) SECOND);

alter table `tickets` drop column ready_date;
alter table `tickets` drop column ready_time;
unlock tables;

lock tables `held_tickets` write;
alter table `held_tickets` add column fire_at datetime default null;
alter table `held_tickets` add column ready_at datetime default null;

UPDATE `held_tickets` SET ready_at = DATE_ADD(ready_date, INTERVAL TIME_TO_SEC(ready_time) SECOND);

alter table `held_tickets` drop column ready_date;
alter table `held_tickets` drop column ready_time;
unlock tables;

-- example:
-- mysql> select ready_date, ready_time, ready_at, DATE_ADD(ready_date, INTERVAL TIME_TO_SEC(ready_time) SECOND) from tickets;
-- +------------+------------+----------+---------------------------------------------------------------+
-- | ready_date | ready_time | ready_at | DATE_ADD(ready_date, INTERVAL TIME_TO_SEC(ready_time) SECOND) |
-- +------------+------------+----------+---------------------------------------------------------------+
-- | NULL       | NULL       | NULL     | NULL                                                          |
-- | 2019-05-31 | 08:20:34   | NULL     | 2019-05-31 08:20:34                                           |
-- | 2019-05-31 | 09:30:00   | NULL     | 2019-05-31 09:30:00                                           |
-- | 2019-05-31 | 12:30:00   | NULL     | 2019-05-31 12:30:00                                           |
-- | 2019-05-31 | 08:25:23   | NULL     | 2019-05-31 08:25:23                                           |
-- | 2019-05-31 | 08:26:17   | NULL     | 2019-05-31 08:26:17                                           |
-- | 2019-05-31 | 08:27:08   | NULL     | 2019-05-31 08:27:08                                           |
-- | NULL       | NULL       | NULL     | NULL                                                          |
-- | NULL       | NULL       | NULL     | NULL                                                          |
-- | NULL       | NULL       | NULL     | NULL                                                          |
-- | NULL       | NULL       | NULL     | NULL                                                          |
-- | NULL       | NULL       | NULL     | NULL                                                          |
-- | NULL       | NULL       | NULL     | NULL                                                          |
-- | NULL       | NULL       | NULL     | NULL                                                          |
