Architecture: Six focused services with the BookingService/SchedulingService overlap resolved by giving SchedulingService exactly one job, the transactional double-booking guard , while BookingService owns the create/reschedule/cancel workflow around it. 59 unit tests, 24 integration tests
22 lines
1.0 KiB
PL/PgSQL
22 lines
1.0 KiB
PL/PgSQL
-- AlterEnum
|
|
BEGIN;
|
|
CREATE TYPE "AppointmentStatus_new" AS ENUM ('PENDING', 'CONFIRMED', 'CHECKED_IN', 'IN_PROGRESS', 'COMPLETED', 'CANCELLED', 'NO_SHOW');
|
|
ALTER TABLE "public"."Appointment" ALTER COLUMN "status" DROP DEFAULT;
|
|
ALTER TABLE "Appointment" ALTER COLUMN "status" TYPE "AppointmentStatus_new" USING ("status"::text::"AppointmentStatus_new");
|
|
ALTER TYPE "AppointmentStatus" RENAME TO "AppointmentStatus_old";
|
|
ALTER TYPE "AppointmentStatus_new" RENAME TO "AppointmentStatus";
|
|
DROP TYPE "public"."AppointmentStatus_old";
|
|
ALTER TABLE "Appointment" ALTER COLUMN "status" SET DEFAULT 'CONFIRMED';
|
|
COMMIT;
|
|
|
|
-- AlterTable
|
|
ALTER TABLE "Appointment" ADD COLUMN "cancelledAt" TIMESTAMP(3),
|
|
ADD COLUMN "cancelledByUserId" TEXT;
|
|
|
|
-- AlterTable
|
|
ALTER TABLE "BookingRule" ADD COLUMN "maxAppointmentsPerStaffPerDay" INTEGER;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "Appointment" ADD CONSTRAINT "Appointment_cancelledByUserId_fkey" FOREIGN KEY ("cancelledByUserId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
|