Fix faulty migration on sqlite
Fix unit tests for changed generate_ticket_granting_ticket