forked from imbytecat/fullstack-starter
16 lines
532 B
TypeScript
16 lines
532 B
TypeScript
import { sql } from 'drizzle-orm'
|
|
import { boolean, pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core'
|
|
|
|
export const todoTable = pgTable('todo', {
|
|
id: uuid('id').primaryKey().default(sql`uuidv7()`),
|
|
title: text('title').notNull(),
|
|
completed: boolean('completed').notNull().default(false),
|
|
createdAt: timestamp('created_at', { withTimezone: true })
|
|
.notNull()
|
|
.defaultNow(),
|
|
updatedAt: timestamp('updated_at', { withTimezone: true })
|
|
.notNull()
|
|
.defaultNow()
|
|
.$onUpdateFn(() => new Date()),
|
|
})
|