import { pgTable, uuid, bigint, timestamp } from "drizzle-orm/pg-core" import { authProfiles } from "./auth_profiles" import { teams } from "./teams" import { authUsers } from "./auth_users" export const authProfileTeams = pgTable( "auth_profile_teams", { created_at: timestamp("created_at", { withTimezone: true }) .notNull() .defaultNow(), profile_id: uuid("profile_id") .notNull() .references(() => authProfiles.id, { onDelete: "cascade" }), team_id: bigint("team_id", { mode: "number" }) .notNull() .references(() => teams.id, { onDelete: "cascade" }), created_by: uuid("created_by").references(() => authUsers.id), }, (table) => ({ primaryKey: [table.profile_id, table.team_id], }) ) export type AuthProfileTeam = typeof authProfileTeams.$inferSelect export type NewAuthProfileTeam = typeof authProfileTeams.$inferInsert