fix syntax error
Use upsert for timer to avoid key contraint violation
Add test skeleton