16 lines
No EOL
565 B
TypeScript
16 lines
No EOL
565 B
TypeScript
import { pgTable, uuid, text, timestamp } from "drizzle-orm/pg-core";
|
|
import { users } from "./users";
|
|
|
|
export const stripeAccounts = pgTable("stripe_accounts", {
|
|
id: uuid("id").defaultRandom().primaryKey(),
|
|
userId: uuid("user_id")
|
|
.notNull()
|
|
.unique() // One user = one Stripe connection
|
|
.references(() => users.id, { onDelete: "cascade" }),
|
|
stripeAccountId: text("stripe_account_id")
|
|
.notNull()
|
|
.unique(), // One Stripe account = one user
|
|
createdAt: timestamp("created_at", { withTimezone: true })
|
|
.notNull()
|
|
.defaultNow(),
|
|
}); |