-- alembic revision 2caed45e3853

lock tables `tickets` write;
alter table `tickets` add column ready_date date default null;
alter table `tickets` add column ready_time time default null;

UPDATE `tickets` SET ready_date = DATE(ready_at), ready_time = TIME(ready_at);

alter table `tickets` drop column fire_at;
alter table `tickets` drop column ready_at;
unlock tables;

lock tables `held_tickets` write;
alter table `held_tickets` add column ready_date date default null;
alter table `held_tickets` add column ready_time time default null;

UPDATE `held_tickets` SET ready_date = DATE(ready_at), ready_time = TIME(ready_at);

alter table `held_tickets` drop column fire_at;
alter table `held_tickets` drop column ready_at;
unlock tables;

-- example:
-- mysql> UPDATE tickets SET ready_date = DATE(ready_at), ready_time = TIME(ready_at);
-- Query OK, 263 rows affected (0.01 sec)
-- Rows matched: 375  Changed: 263  Warnings: 0
--
-- mysql> select ready_date, ready_time, ready_at from tickets;
-- +------------+------------+---------------------+
-- | ready_date | ready_time | ready_at            |
-- +------------+------------+---------------------+
-- | NULL       | NULL       | NULL                |
-- | 2019-05-31 | 08:20:34   | 2019-05-31 08:20:34 |
-- | 2019-05-31 | 09:30:00   | 2019-05-31 09:30:00 |
-- | 2019-05-31 | 12:30:00   | 2019-05-31 12:30:00 |
-- | 2019-05-31 | 08:25:23   | 2019-05-31 08:25:23 |
-- | 2019-05-31 | 08:26:17   | 2019-05-31 08:26:17 |
-- | 2019-05-31 | 08:27:08   | 2019-05-31 08:27:08 |
-- | NULL       | NULL       | NULL                |
-- | NULL       | NULL       | NULL                |
-- | NULL       | NULL       | NULL                |
-- | NULL       | NULL       | NULL                |
-- | NULL       | NULL       | NULL                |
