From a6ba4f8257cc45d03e89d1d3d750f30898a7e54b Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Sun, 17 Mar 2024 19:39:37 -0500 Subject: [PATCH] Change db field: description to semantic_description --- src/photo/form/index.ts | 4 ++-- src/photo/index.ts | 2 +- src/services/vercel-postgres.ts | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/photo/form/index.ts b/src/photo/form/index.ts index ec10e46a..078e36c6 100644 --- a/src/photo/form/index.ts +++ b/src/photo/form/index.ts @@ -68,8 +68,8 @@ const FORM_METADATA = ( validateStringMaxLength: STRING_MAX_LENGTH_LONG, shouldHide: ({ title, caption }) => !title && !caption, }, - description: { - label: 'description', + semanticDescription: { + label: 'semantic description', capitalize: true, validateStringMaxLength: STRING_MAX_LENGTH_LONG, hide: true, diff --git a/src/photo/index.ts b/src/photo/index.ts index cb4a003a..5156e4b4 100644 --- a/src/photo/index.ts +++ b/src/photo/index.ts @@ -48,7 +48,7 @@ export interface PhotoDbInsert extends PhotoExif { blurData?: string title?: string caption?: string - description?: string + semanticDescription?: string tags?: string[] locationName?: string priorityOrder?: number diff --git a/src/services/vercel-postgres.ts b/src/services/vercel-postgres.ts index 4c234b05..8516c62e 100644 --- a/src/services/vercel-postgres.ts +++ b/src/services/vercel-postgres.ts @@ -29,7 +29,7 @@ const sqlCreatePhotosTable = () => blur_data TEXT, title VARCHAR(255), caption TEXT, - description TEXT, + semantic_description TEXT, tags VARCHAR(255)[], make VARCHAR(255), model VARCHAR(255), @@ -53,12 +53,12 @@ const sqlCreatePhotosTable = () => `; // Migration 01 -const MIGRATION_FIELDS_01 = ['caption', 'description']; +const MIGRATION_FIELDS_01 = ['caption', 'semantic_description']; const sqlRunMigration01 = () => sql` ALTER TABLE photos ADD COLUMN IF NOT EXISTS caption TEXT, - ADD COLUMN IF NOT EXISTS description TEXT + ADD COLUMN IF NOT EXISTS semantic_description TEXT `; // Must provide id as 8-character nanoid @@ -72,7 +72,7 @@ export const sqlInsertPhoto = (photo: PhotoDbInsert) => blur_data, title, caption, - description, + semantic_description, tags, make, model, @@ -99,7 +99,7 @@ export const sqlInsertPhoto = (photo: PhotoDbInsert) => ${photo.blurData}, ${photo.title}, ${photo.caption}, - ${photo.description}, + ${photo.semanticDescription}, ${convertArrayToPostgresString(photo.tags)}, ${photo.make}, ${photo.model}, @@ -129,7 +129,7 @@ export const sqlUpdatePhoto = (photo: PhotoDbInsert) => blur_data=${photo.blurData}, title=${photo.title}, caption=${photo.caption}, - description=${photo.description}, + semantic_description=${photo.semanticDescription}, tags=${convertArrayToPostgresString(photo.tags)}, make=${photo.make}, model=${photo.model},