import { pgTable, uuid, text, timestamp } from "drizzle-orm/pg-core"; import { users } from "./users"; export const xeroConnections = pgTable("xero_connections", { id: uuid("id").defaultRandom().primaryKey(), userId: uuid("user_id") .notNull() .references(() => users.id, { onDelete: "cascade" }), tenantId: text("tenant_id").notNull(), // 🔐 OAuth tokens accessToken: text("access_token").notNull(), refreshToken: text("refresh_token").notNull(), // When access_token expires expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(), createdAt: timestamp("created_at", { withTimezone: true }) .notNull() .defaultNow(), updatedAt: timestamp("updated_at", { withTimezone: true }) .notNull() .defaultNow(), });