import { TableColumn } from "typeorm"; /** * Creates a TableColumn definition for a timestamp column. * * @param name - The name of the column. Defaults to "created_at" or "updated_at". * @returns {TableColumn} - A TableColumn object configured as a timestamp column. */ export const timestampColumn = ( name: "created_at" | "updated_at" = "created_at" ): TableColumn => { return { name, type: "timestamp", default: "CURRENT_TIMESTAMP", onUpdate: name === "updated_at" ? "CURRENT_TIMESTAMP" : undefined, isNullable: false, } as TableColumn; };