Skip to content

Commit

Permalink
fix: set show location to NULL if unknown
Browse files Browse the repository at this point in the history
This patch updates my Prisma schema to make the show location field
optional. I will set this field to `NULL` when I do not know it
conclusively. I will show "Unknown" in the front-end if it is missing.
  • Loading branch information
nicholaschiang committed Jul 25, 2023
1 parent 66e190f commit a21fdd4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/routes/shows.$showId/show-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function ShowInfo() {
dateStyle: 'long',
})}
</InfoItem>
<InfoItem label='Location'>{show.location}</InfoItem>
<InfoItem label='Location'>{show.location ?? 'Unknown'}</InfoItem>
<InfoItem label='Looks'>{show.looks.length}</InfoItem>
<InfoItem
label={show.brands.length === 1 ? 'Brand' : 'Brands'}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Show" ALTER COLUMN "location" DROP NOT NULL;
2 changes: 1 addition & 1 deletion prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ model Show {
// The runway show's location.
// @todo perhaps this should be a separate model and simply a relation here.
location String
location String?
// The collections that were presented at the show. Often, there is only one.
collections Collection[]
Expand Down

0 comments on commit a21fdd4

Please sign in to comment.