KWAC
KWAC
Explore posts from servers
DTDrizzle Team
Created by KWAC on 7/31/2024 in #help
quering with nuxt + drizzle + cloudflare D1
I'm using nuxt + drizzle orm + cloudflare D1. my schema.ts looks like this
import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core"

export const user = sqliteTable('users', {
id: text("id").primaryKey(),
firstname: text("first_name").notNull(),
lastname: text("last_name").notNull(),
email: text("email").unique().notNull(),
username: text("username").unique().notNull(),
password: text("password").notNull(),
confirm_password: text("confirm_password").notNull(),
country: text("country").notNull(),
gender: text("gender").notNull(),
date_of_birth: text("date_of_birth").notNull(),
selectedPhoneCode: text("selectedPhoneCode").notNull(),
phone: text("phone").notNull(),
created_at: integer('created_at', { mode: 'timestamp' }).notNull()
})


export const session = sqliteTable("session", {
id: text("id").primaryKey(),
expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
userId: text("user_id")
.notNull()
.references(() => user.id, { onDelete: "cascade" }),
})
import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core"

export const user = sqliteTable('users', {
id: text("id").primaryKey(),
firstname: text("first_name").notNull(),
lastname: text("last_name").notNull(),
email: text("email").unique().notNull(),
username: text("username").unique().notNull(),
password: text("password").notNull(),
confirm_password: text("confirm_password").notNull(),
country: text("country").notNull(),
gender: text("gender").notNull(),
date_of_birth: text("date_of_birth").notNull(),
selectedPhoneCode: text("selectedPhoneCode").notNull(),
phone: text("phone").notNull(),
created_at: integer('created_at', { mode: 'timestamp' }).notNull()
})


export const session = sqliteTable("session", {
id: text("id").primaryKey(),
expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
userId: text("user_id")
.notNull()
.references(() => user.id, { onDelete: "cascade" }),
})
3 replies