From 0f4c5e904119785acbea4454acb1613a92793988 Mon Sep 17 00:00:00 2001 From: Nicholas Chiang Date: Mon, 24 Jul 2023 22:33:39 -0600 Subject: [PATCH] feat(prisma): add review "written at" date field This patch adds a new `date` field to the `Review` object. This date field will be `NULL` for consumer reviews (as the written at date for consumer reviews will simply be createdAt/updatedAt). For critic reviews, this is a separate field as most of the time, the date when the critic review was originally written will be different from the date I imported it. --- .../migration.sql | 2 ++ prisma/schema.prisma | 8 ++++++++ 2 files changed, 10 insertions(+) create mode 100644 prisma/migrations/20230725043335_add_review_written_at_date/migration.sql diff --git a/prisma/migrations/20230725043335_add_review_written_at_date/migration.sql b/prisma/migrations/20230725043335_add_review_written_at_date/migration.sql new file mode 100644 index 00000000..5a94108e --- /dev/null +++ b/prisma/migrations/20230725043335_add_review_written_at_date/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "Review" ADD COLUMN "date" TIMESTAMP(3); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 01fc62ee..c3f2d387 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -798,6 +798,14 @@ model Review { // The review article URL (if it was posted online e.g. on Vogue). url String? @unique + // The date when the review article was originally written (if known). + // + // This will be NULL for consumer reviews (as this would be redundant with the + // database createdAt field for consumer reviews). For critic reviews, the + // date when the review was originally written and the time when I imported it + // will often be different (which is why this field exists separately). + date DateTime? + // Each user can only submit one review per show. This may be different for // critic reviews, but, for now, I've yet to encounter the same journalist // publishing two different reviews for the same show. If that does happen, I