Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c18e094

Browse files
committed
fix(preview): handle strings format when generating insert query
1 parent 994ae98 commit c18e094

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/runtime/internal/preview/collection.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ function computeValuesBasedOnCollectionSchema(collection: CollectionInfo, data:
112112
if (type === 'json') {
113113
values.push(`'${JSON.stringify(valueToInsert).replace(/'/g, '\'\'')}'`)
114114
}
115-
else if (type === 'string') {
115+
// @ts-expect-error format does exist
116+
else if (type === 'string' || ['string', 'enum'].includes(value.type)) {
116117
// @ts-expect-error format does exist
117118
if (['data', 'datetime'].includes(value.format)) {
118119
values.push(valueToInsert !== 'NULL' ? `'${new Date(valueToInsert).toISOString()}'` : defaultValue)

0 commit comments

Comments
 (0)