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:
Wuesteon 2025-12-09 16:30:51 +01:00
parent 4e63f3f74b
commit f440ca2a8d
33 changed files with 73 additions and 53 deletions

View file

@ -1,4 +1,4 @@
import { pgTable, uuid, timestamp, varchar, text, boolean, jsonb } from 'drizzle-orm/pg-core';
import { pgTable, uuid, text, timestamp, varchar, boolean, jsonb } from 'drizzle-orm/pg-core';
/**
* Calendar settings stored in JSONB
@ -16,7 +16,7 @@ export interface CalendarSettings {
*/
export const calendars = pgTable('calendars', {
id: uuid('id').primaryKey().defaultRandom(),
userId: uuid('user_id').notNull(),
userId: text('user_id').notNull(),
name: varchar('name', { length: 255 }).notNull(),
description: text('description'),
color: varchar('color', { length: 7 }).default('#3B82F6'),

View file

@ -1,9 +1,9 @@
import {
pgTable,
uuid,
text,
timestamp,
varchar,
text,
boolean,
jsonb,
index,
@ -41,7 +41,7 @@ export const events = pgTable(
calendarId: uuid('calendar_id')
.notNull()
.references(() => calendars.id, { onDelete: 'cascade' }),
userId: uuid('user_id').notNull(),
userId: text('user_id').notNull(),
// Basic info
title: varchar('title', { length: 500 }).notNull(),

View file

@ -1,9 +1,9 @@
import {
pgTable,
uuid,
text,
timestamp,
varchar,
text,
boolean,
jsonb,
integer,
@ -27,7 +27,7 @@ export interface ExternalCalendarProviderData {
*/
export const externalCalendars = pgTable('external_calendars', {
id: uuid('id').primaryKey().defaultRandom(),
userId: uuid('user_id').notNull(),
userId: text('user_id').notNull(),
// Calendar identification
name: varchar('name', { length: 255 }).notNull(),

View file

@ -1,4 +1,13 @@
import { pgTable, uuid, timestamp, varchar, integer, boolean, index } from 'drizzle-orm/pg-core';
import {
pgTable,
uuid,
text,
timestamp,
varchar,
integer,
boolean,
index,
} from 'drizzle-orm/pg-core';
import { events } from './events.schema';
/**
@ -11,7 +20,7 @@ export const reminders = pgTable(
eventId: uuid('event_id')
.notNull()
.references(() => events.id, { onDelete: 'cascade' }),
userId: uuid('user_id').notNull(),
userId: text('user_id').notNull(),
// Timing
minutesBefore: integer('minutes_before').notNull(),