
* wip * tmp mig * add cron api key to header * feels safer * Revert "wip" This reverts commit 15a8358661c6785ce9eedb93a473a8829f79d760. * test * add name * normalize dates * maybe works * test * fixz * maybe fix ci * deprecated * step 1 -- raw sql * seems to work * migration seems to work * br * fix comment * timouet * disconnect prisma test * test order * maybs * seems to work * tz * tweak Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: Alex van Andel <me@alexvanandel.com>
20 lines
626 B
SQL
20 lines
626 B
SQL
|
|
insert into "Availability" ("userId", "startTime", "endTime", "days")
|
|
select
|
|
id as "userId",
|
|
CAST(CONCAT(CAST(("startTime") AS text), ' minute')::interval AS time) as "startTime",
|
|
CAST(CONCAT(CAST(("endTime") AS text), ' minute')::interval AS time) as "endTime",
|
|
ARRAY [0,1,2,3,4,5,6]
|
|
from
|
|
(
|
|
select
|
|
users.id,
|
|
users."startTime",
|
|
users."endTime",
|
|
users."timeZone",
|
|
count("Availability".id) as availability_count
|
|
from users
|
|
left join "Availability" on "Availability"."userId" = users.id
|
|
group by users.id
|
|
) usersWithAvailabilityNumber
|
|
where availability_count < 1
|