© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•7mo ago•
3 replies
jsingleton37

Sanity + Supabase question

I currently have this drizzle schema for my supabase db
export const voterBallots = pgTable('voter_ballot', {
  id: serial('id').primaryKey(),
  userId: varchar('userId', { length: 256 }).notNull(),
  division: varchar('division', { length: 10 }).notNull(),
  week: integer('week').notNull(),
  year: integer('year')
    .default(sql`EXTRACT(year FROM CURRENT_DATE)`)
    .notNull(),
  createdAt: timestamp('created_at')
    .default(sql`CURRENT_TIMESTAMP`)
    .notNull(),
  teamId: varchar('team_id', { length: 256 }).notNull(),
  rank: integer('rank').notNull(),
  points: integer('points').notNull(),
})
export const voterBallots = pgTable('voter_ballot', {
  id: serial('id').primaryKey(),
  userId: varchar('userId', { length: 256 }).notNull(),
  division: varchar('division', { length: 10 }).notNull(),
  week: integer('week').notNull(),
  year: integer('year')
    .default(sql`EXTRACT(year FROM CURRENT_DATE)`)
    .notNull(),
  createdAt: timestamp('created_at')
    .default(sql`CURRENT_TIMESTAMP`)
    .notNull(),
  teamId: varchar('team_id', { length: 256 }).notNull(),
  rank: integer('rank').notNull(),
  points: integer('points').notNull(),
})


The
teamId
teamId
here ends up being the
_id
_id
of the school document from sanity since our articles reference schools and figured it was better than duplicating content from Sanity into Supabase. I am going to be adding a new column for
sport
sport
... The sports live in my Sanity CMS just like the teams that fill the teamId in the schema. Would it be better to use the sportId instead of the name of the sport? Should I mirror what's in my Sanity CMS into my database? Not sure what would be best in this scenario. I was originally thinking the sport slug but then that could change for whatever reason so figured using the
_id
_id
would be best, it would just involve some extra querying.
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Supabase / Postgres question
SupabaseSSupabase / help-and-questions
14mo ago
Supabase JS query question
SupabaseSSupabase / help-and-questions
13mo ago
Supabase Storage SignedUrls question
SupabaseSSupabase / help-and-questions
14mo ago
Supabase postgres memory management question
SupabaseSSupabase / help-and-questions
4mo ago