-- alembic revision 059619ce78d0

create table `async_ticket_payments` (
  `_cache_id` varchar(128) collate utf8_bin not null,
  `key` bigint(20) not null auto_increment,
  `ticket_id` varchar(64) collate utf8_bin not null,
  `type` varchar(32) collate utf8_bin not null,
  `amount` int(11) not null,
  `tip` int(11) not null,
  `comment` text collate utf8_bin,
  `full_name` varchar(128) collate utf8_bin default null,
  `tender_type_id` varchar(64) collate utf8_bin default null,
  primary key (`key`,`_cache_id`),
  key `fk_async_ticket_payments_ticket_close_candidates` (`_cache_id`,`ticket_id`),
  constraint `fk_async_ticket_payments_ticket_close_candidates` foreign key (`_cache_id`, `ticket_id`)
  references `ticket_close_candidates` (`_cache_id`, `ticket_id`) on delete cascade on update cascade
) engine=InnoDB default charset=utf8 collate=utf8_bin;

alter table ticket_close_candidates 
  add column `close_type` varchar(64) collate utf8_bin not null after auth,
  drop key ticket_id_idx,
  add unique key `ticket_id_idx` (`_cache_id`,`ticket_id`);