mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-19 22:21:24 +02:00
fix(db): use TEXT for user_id columns across entire codebase
Better Auth generates non-UUID user IDs (32-char base62 format like
'otUe1YrfENPdHnrF3g1vSBfpkQfambCZ'). Changed all `uuid('user_id')` to
`text('user_id')` in Drizzle schemas for consistency with auth system.
Affected packages/apps:
- apps/calendar, clock, picture, zitare
- games/figgos, voxelava
- packages/manadeck-database, news-database, uload-database
- services/mana-core-auth (feedback schema)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
4e63f3f74b
commit
f440ca2a8d
33 changed files with 73 additions and 53 deletions
|
|
@ -29,7 +29,7 @@ export const articles = pgTable(
|
|||
summary: text('summary'),
|
||||
|
||||
// For user-saved articles
|
||||
userId: uuid('user_id').references(() => users.id, { onDelete: 'cascade' }),
|
||||
userId: text('user_id').references(() => users.id, { onDelete: 'cascade' }),
|
||||
originalUrl: text('original_url'),
|
||||
parsedContent: text('parsed_content'),
|
||||
isArchived: boolean('is_archived').default(false),
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { users } from './users';
|
|||
// Better Auth Sessions
|
||||
export const sessions = pgTable('sessions', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
userId: uuid('user_id')
|
||||
userId: text('user_id')
|
||||
.references(() => users.id, { onDelete: 'cascade' })
|
||||
.notNull(),
|
||||
token: text('token').notNull().unique(),
|
||||
|
|
@ -18,7 +18,7 @@ export const sessions = pgTable('sessions', {
|
|||
// Better Auth Accounts (for OAuth providers)
|
||||
export const accounts = pgTable('accounts', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
userId: uuid('user_id')
|
||||
userId: text('user_id')
|
||||
.references(() => users.id, { onDelete: 'cascade' })
|
||||
.notNull(),
|
||||
providerId: text('provider_id').notNull(), // 'credential', 'google', 'apple', etc.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import {
|
||||
pgTable,
|
||||
uuid,
|
||||
text,
|
||||
timestamp,
|
||||
boolean,
|
||||
real,
|
||||
|
|
@ -15,7 +16,7 @@ export const userArticleInteractions = pgTable(
|
|||
'user_article_interactions',
|
||||
{
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
userId: uuid('user_id')
|
||||
userId: text('user_id')
|
||||
.references(() => users.id, { onDelete: 'cascade' })
|
||||
.notNull(),
|
||||
articleId: uuid('article_id')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue