mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 20:01:09 +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
|
|
@ -1,4 +1,4 @@
|
|||
import { pgTable, uuid, timestamp, unique } from 'drizzle-orm/pg-core';
|
||||
import { pgTable, uuid, text, timestamp, unique } from 'drizzle-orm/pg-core';
|
||||
import { relations } from 'drizzle-orm';
|
||||
import { figures } from './figures.schema';
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ export const figureLikes = pgTable(
|
|||
figureId: uuid('figure_id')
|
||||
.notNull()
|
||||
.references(() => figures.id, { onDelete: 'cascade' }),
|
||||
userId: uuid('user_id').notNull(),
|
||||
userId: text('user_id').notNull(),
|
||||
createdAt: timestamp('created_at').defaultNow(),
|
||||
},
|
||||
(table) => ({
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export const figures = pgTable('figures', {
|
|||
isPublic: boolean('is_public').default(true),
|
||||
isArchived: boolean('is_archived').default(false),
|
||||
likes: integer('likes').default(0),
|
||||
userId: uuid('user_id').notNull(),
|
||||
userId: text('user_id').notNull(),
|
||||
createdAt: timestamp('created_at').defaultNow(),
|
||||
updatedAt: timestamp('updated_at').defaultNow(),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { pgTable, uuid, timestamp, unique } from 'drizzle-orm/pg-core';
|
||||
import { pgTable, uuid, text, timestamp, unique } from 'drizzle-orm/pg-core';
|
||||
import { relations } from 'drizzle-orm';
|
||||
import { levels } from './levels.schema';
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ export const levelLikes = pgTable(
|
|||
levelId: uuid('level_id')
|
||||
.notNull()
|
||||
.references(() => levels.id, { onDelete: 'cascade' }),
|
||||
userId: uuid('user_id').notNull(),
|
||||
userId: text('user_id').notNull(),
|
||||
createdAt: timestamp('created_at').defaultNow(),
|
||||
},
|
||||
(table) => ({
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { pgTable, uuid, timestamp, real, integer, boolean } from 'drizzle-orm/pg-core';
|
||||
import { pgTable, uuid, text, timestamp, real, integer, boolean } from 'drizzle-orm/pg-core';
|
||||
import { relations } from 'drizzle-orm';
|
||||
import { levels } from './levels.schema';
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ export const levelPlays = pgTable('level_plays', {
|
|||
levelId: uuid('level_id')
|
||||
.notNull()
|
||||
.references(() => levels.id, { onDelete: 'cascade' }),
|
||||
userId: uuid('user_id'),
|
||||
userId: text('user_id'),
|
||||
completionTime: real('completion_time'),
|
||||
attempts: integer('attempts').default(1),
|
||||
completed: boolean('completed').default(false),
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ export const levels = pgTable('levels', {
|
|||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
name: text('name').notNull(),
|
||||
description: text('description'),
|
||||
userId: uuid('user_id').notNull(),
|
||||
userId: text('user_id').notNull(),
|
||||
voxelData: jsonb('voxel_data').notNull(),
|
||||
spawnPoint: jsonb('spawn_point').notNull(),
|
||||
worldSize: jsonb('world_size').notNull(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue