Setting default timestamp in user table

So Im using turso with sqlite and out of nowhere i have been issuing this issue with my user table, im using nextauthjs

import { sql } from 'drizzle-orm';
import { sqliteTable, text, primaryKey, integer, int } from 'drizzle-orm/sqlite-core';
import type { AdapterAccountType } from 'next-auth/adapters';
import { createId } from '@paralleldrive/cuid2';

export const user = sqliteTable('user', {
 id: text('id')
  .primaryKey()
  .$defaultFn(() => createId()),
 name: text('name'),
 email: text('email').notNull(),
 emailVerified: integer('emailVerified', { mode: 'timestamp_ms' }),
 image: text('image'),
 role: text('role').$type<'USER' | 'ADMIN'>().notNull().default('USER'),
 joinedAt: integer('joinedAt', { mode: 'timestamp_ms' })
  .notNull()
  .$defaultFn(() => sql`(unixepoch() * 1000)`),
});
Was this page helpful?