Variable: fileMetadataColumns
constfileMetadataColumns:object
Common file metadata columns for tables that reference files stored in Azure Blob Storage. Use these columns when your table stores metadata about a file (blob_name, file_original_name, mimetype, size). Timestamps (created_at / updated_at) are not included — declare them on each table so non-file tables and file tables share the same timestamp pattern.
Type declaration
blob_name
readonlyblob_name:NotNull<SQLiteTextBuilderInitial<"blob_name", [string,...string[]],undefined|number>>>>
file_original_name
readonlyfile_original_name:NotNull<SQLiteTextBuilderInitial<"file_original_name", [string,...string[]],undefined|number>>>>
md5_hash
readonlymd5_hash:SQLiteTextBuilderInitial<"md5_hash", [string,...string[]],undefined|number>>
mimetype
readonlymimetype:NotNull<SQLiteTextBuilderInitial<"mimetype", [string,...string[]],undefined|number>>>>
size
readonlysize:NotNull<SQLiteIntegerBuilderInitial<"size">>>>
Example
import { fileMetadataColumns, generateShortId } from "@saflib/drizzle";
import { integer } from "drizzle-orm/sqlite-core";
export const myFileTable = sqliteTable("my_file", {
id: text("id")
.primaryKey()
.$defaultFn(() => generateShortId()),
...fileMetadataColumns,
created_at: integer("created_at", { mode: "timestamp" })
.notNull()
.$defaultFn(() => new Date()),
updated_at: integer("updated_at", { mode: "timestamp" })
.notNull()
.$defaultFn(() => new Date()),
});