From 5ef04eabb26462cf4245b8d90b0b615398dae9fb Mon Sep 17 00:00:00 2001 From: Till-JS <101404291+Till-JS@users.noreply.github.com> Date: Sat, 14 Feb 2026 13:44:05 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(nutriphi-backend):=20change?= =?UTF-8?q?=20user=5Fid=20from=20uuid=20to=20text?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Better Auth generates string IDs, not UUIDs. Updated schema to match other apps like Calendar that use text for user_id. Co-Authored-By: Claude Opus 4.5 --- apps/nutriphi/apps/backend/src/db/schema/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/nutriphi/apps/backend/src/db/schema/index.ts b/apps/nutriphi/apps/backend/src/db/schema/index.ts index 6aca5498d..188bb45f1 100644 --- a/apps/nutriphi/apps/backend/src/db/schema/index.ts +++ b/apps/nutriphi/apps/backend/src/db/schema/index.ts @@ -13,7 +13,7 @@ import { // User Goals export const userGoals = pgTable('user_goals', { id: uuid('id').primaryKey().defaultRandom(), - userId: uuid('user_id').notNull(), + userId: text('user_id').notNull(), dailyCalories: integer('daily_calories').notNull().default(2000), dailyProtein: integer('daily_protein'), // grams dailyCarbs: integer('daily_carbs'), // grams @@ -26,7 +26,7 @@ export const userGoals = pgTable('user_goals', { // Meals export const meals = pgTable('meals', { id: uuid('id').primaryKey().defaultRandom(), - userId: uuid('user_id').notNull(), + userId: text('user_id').notNull(), date: timestamp('date').notNull(), mealType: varchar('meal_type', { length: 20 }).notNull(), // breakfast, lunch, dinner, snack inputType: varchar('input_type', { length: 20 }).notNull(), // photo, text @@ -83,7 +83,7 @@ export const mealNutrition = pgTable('meal_nutrition', { // Favorite Meals export const favoriteMeals = pgTable('favorite_meals', { id: uuid('id').primaryKey().defaultRandom(), - userId: uuid('user_id').notNull(), + userId: text('user_id').notNull(), name: varchar('name', { length: 255 }).notNull(), description: text('description').notNull(), mealType: varchar('meal_type', { length: 20 }).notNull(), @@ -96,7 +96,7 @@ export const favoriteMeals = pgTable('favorite_meals', { // Recommendations export const recommendations = pgTable('recommendations', { id: uuid('id').primaryKey().defaultRandom(), - userId: uuid('user_id').notNull(), + userId: text('user_id').notNull(), date: timestamp('date').notNull(), type: varchar('type', { length: 20 }).notNull(), // hint, coaching priority: varchar('priority', { length: 20 }).notNull().default('medium'), // low, medium, high