stacker.news/prisma/migrations/20230203193324_streak_update/migration.sql

3 lines
165 B
MySQL
Raw Normal View History

UPDATE users set streak = (now() AT TIME ZONE 'America/Chicago')::date - "Streak"."startedAt"
FROM "Streak"
WHERE "endedAt" IS NULL AND users.id = "Streak"."userId";