This is the content of my schema.ts file:
export const messages = pgTable("messages", {
id: serial("id").primaryKey(),
chatId: integer("chat_id")
.references(() => chats.id)
.notNull(),
content: text("content").notNull(),
createdAt: timestamp("created_at").notNull().defaultNow(),
role: userSystemEnum("role").notNull(),
});
An error is being thrown stating:
error: column "created_at" cannot be cast automatically to type timestamp without time zone
at Parser.parseErrorMessage (A:\sark and other\chatpdf-yt-main\node_modules\drizzle-kit\index.cjs:40722:98)
at Parser.handlePacket (A:\sark and other\chatpdf-yt-main\node_modules\drizzle-kit\index.cjs:40563:25)
at Parser.parse (A:\sark and other\chatpdf-yt-main\node_modules\drizzle-kit\index.cjs:40487:34)
at TLSSocket.<anonymous> (A:\sark and other\chatpdf-yt-main\node_modules\drizzle-kit\index.cjs:40763:44)
at TLSSocket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Readable.push (node:internal/streams/readable:234:10)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
length: 231,
severity: 'ERROR',
code: '42804',
detail: undefined,
hint: 'You might need to specify "USING created_at::timestamp without time zone".',
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'tablecmds.c',
line: '12302',
routine: 'ATPrepAlterColumnType'
}
The same error is also appearing for the 'role' field:
export const userSystemEnum = pgEnum("user_system_enum", ["system", "user"]);
hint: 'You might need to specify "USING role::user_system_enum".'
What steps should I take to resolve this issue?