feat: add userCharacterHistory table schema and update journal with new version

This commit is contained in:
2026-03-02 20:42:44 +01:00
parent 949d9596a6
commit 1ba853771e
4 changed files with 1192 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
import { integer, sqliteTable, text, real } from 'drizzle-orm/sqlite-core';
import { user } from './auth.schema';
// Define devil fruit types
export type DevilFruitType = 'Paramecia' | 'Zoan' | 'Logia' | 'Unknown';
@@ -106,5 +107,16 @@ export const characterHistory = sqliteTable('characterHistory', {
updatedAt: integer('updatedAt').notNull().$default(() => Date.now()),
});
// Define the user character history table schema
export const userCharacterHistory = sqliteTable('userCharacterHistory', {
id: text('id')
.primaryKey()
.$defaultFn(() => crypto.randomUUID()),
userId: text('userId').references(() => user.id),
characterHistoryId: text('characterHistoryId').references(() => characterHistory.id),
tryCount: integer('tryCount').notNull(),
createdAt: integer('createdAt').notNull().$default(() => Date.now())
});
export * from './auth.schema';