upload
upload<
T>(builder,metadata):T
Defined in: packages/forms/src/validate.ts:105
Mark a Drizzle text column as an upload key, capturing the storage filetype and per-field upload settings.
The metadata is stored on the same protected config object that
v writes to, so the two helpers can be combined on a single
column without conflict. introspectTable reads it back and
promotes the column’s inputType to "upload".
Type Parameters
Section titled “Type Parameters”T extends ColumnBuilderBase<ColumnBuilderBaseConfig<ColumnDataType, string>, object>
The Drizzle column builder type, preserved for chaining.
Parameters
Section titled “Parameters”builder
Section titled “builder”T
A Drizzle column builder (e.g., text("image_key")).
metadata
Section titled “metadata”The upload field configuration (filetype + options).
Returns
Section titled “Returns”T
The same builder instance for inline chaining.
Example
Section titled “Example”import { upload } from "@cfast/forms";import { sqliteTable, text } from "drizzle-orm/sqlite-core";
export const products = sqliteTable("products", { imageKey: upload(text("image_key"), { filetype: "productImages", accept: "image/*", maxSize: 5 * 1024 * 1024, }),});