Skip to content

Commit

Permalink
fix: allow show date to be NULL when not known
Browse files Browse the repository at this point in the history
This patch updates the show model to make the `date` field optional so
that I can simply let it be `NULL` when it is not conclusively known.
  • Loading branch information
nicholaschiang committed Jul 25, 2023
1 parent 9ed0077 commit e12c12d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
12 changes: 7 additions & 5 deletions app/routes/shows.$showId/show-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ export function ShowInfo() {
dangerouslySetInnerHTML={{ __html: show.description }}
/>
<dl className='mt-2'>
<InfoItem label='Date'>
{new Date(show.date).toLocaleDateString(undefined, {
dateStyle: 'long',
})}
</InfoItem>
{show.date != null && (
<InfoItem label='Date'>
{new Date(show.date).toLocaleDateString(undefined, {
dateStyle: 'long',
})}
</InfoItem>
)}
{show.location != null && (
<InfoItem label='Location'>{show.location}</InfoItem>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Show" ALTER COLUMN "date" DROP NOT NULL;
4 changes: 2 additions & 2 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -855,8 +855,8 @@ model Show {
season Season @relation(fields: [seasonId], references: [id], onDelete: Cascade, onUpdate: Cascade)
seasonId Int
// The date when the show started.
date DateTime
// The date when the show started (if known).
date DateTime?
// The runway show's location.
// @todo perhaps this should be a separate model and simply a relation here.
Expand Down

0 comments on commit e12c12d

Please sign in to comment.