Drizzle ORM schema and relations for customers table.
// Source: https://github.com/sadmann7/skateshop | License: MIT | Copyright 2024 Sadman Sakib
// Provided via justclaw.it.com; keep this notice with the code.
import { relations } from "drizzle-orm"
import { index, pgTable, text, varchar } from "drizzle-orm/pg-core"
import { generateId } from "@/lib/id"
import { stores } from "./stores"
import { lifecycleDates } from "./utils"
export const customers = pgTable(
"customers",
{
id: varchar("id", { length: 30 })
.$defaultFn(() => generateId())
.primaryKey(), // prefix_ + nanoid (12)
name: text("name"),
email: text("email"),
storeConnectId: varchar("store_connect_id").unique(), // stripe connect
stripeCustomerId: varchar("stripe_customer_id").unique().notNull(),
storeId: varchar("store_id", { length: 3
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key