feat: add userCharacterHistory table schema and update journal with new version
All checks were successful
Build Docker Image / build (push) Successful in 1m22s

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

View File

@@ -0,0 +1,9 @@
CREATE TABLE `userCharacterHistory` (
`id` text PRIMARY KEY NOT NULL,
`userId` text,
`characterId` text,
`tryCount` integer NOT NULL,
`createdAt` integer NOT NULL,
FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action,
FOREIGN KEY (`characterId`) REFERENCES `character`(`id`) ON UPDATE no action ON DELETE no action
);

File diff suppressed because it is too large Load Diff

View File

@@ -29,6 +29,13 @@
"when": 1772449624450,
"tag": "0003_wise_blonde_phantom",
"breakpoints": true
},
{
"idx": 4,
"version": "6",
"when": 1772480377099,
"tag": "0004_unique_lorna_dane",
"breakpoints": true
}
]
}

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';