Tickets database function and schema update