Bytes
A bytes field represents binary data as a Uint8Array in JavaScript.
Options:
defaultValue(default:null): ThisUint8Arrayvalue will be used for the field when creating items if no explicit value is set.db.map: Adds a Prisma@mapattribute to this field which changes the column name in the database.db.isNullable(default:true): Iffalse, this field will be non-nullable in the database.db.nativeType: Changes the Prisma native database type attribute from the default Prisma type for your database. The native type is not customisable on SQLite.validation.isRequired(default:false): Iftrue, this field can never be set tonull.validation.length.min(default:undefined): The minimum length in bytes.validation.length.max(default:undefined): The maximum length in bytes.isIndexed(default:false)- If
truethen this field will be indexed by the database. - If
'unique'then all values of this field must be unique.
- If
graphql.scalar(default: Keystone'sBytesscalar): Allows you to provide a custom GraphQL scalar for serialising and parsing values.
import { config, list } from '@keystone-6/core';import { bytes } from '@keystone-6/core/fields';export default config({lists: {SomeListName: list({fields: {someFieldName: bytes({validation: { length: { max: 1024 } },db: { map: 'my_bytes' },}),/* ... */},}),/* ... */},/* ... */});