feat: add userCharacterHistory table schema and update journal with new version
This commit is contained in:
9
drizzle/0004_unique_lorna_dane.sql
Normal file
9
drizzle/0004_unique_lorna_dane.sql
Normal 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
|
||||||
|
);
|
||||||
1164
drizzle/meta/0004_snapshot.json
Normal file
1164
drizzle/meta/0004_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -29,6 +29,13 @@
|
|||||||
"when": 1772449624450,
|
"when": 1772449624450,
|
||||||
"tag": "0003_wise_blonde_phantom",
|
"tag": "0003_wise_blonde_phantom",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 4,
|
||||||
|
"version": "6",
|
||||||
|
"when": 1772480377099,
|
||||||
|
"tag": "0004_unique_lorna_dane",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { integer, sqliteTable, text, real } from 'drizzle-orm/sqlite-core';
|
import { integer, sqliteTable, text, real } from 'drizzle-orm/sqlite-core';
|
||||||
|
import { user } from './auth.schema';
|
||||||
|
|
||||||
// Define devil fruit types
|
// Define devil fruit types
|
||||||
export type DevilFruitType = 'Paramecia' | 'Zoan' | 'Logia' | 'Unknown';
|
export type DevilFruitType = 'Paramecia' | 'Zoan' | 'Logia' | 'Unknown';
|
||||||
@@ -106,5 +107,16 @@ export const characterHistory = sqliteTable('characterHistory', {
|
|||||||
updatedAt: integer('updatedAt').notNull().$default(() => Date.now()),
|
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';
|
export * from './auth.schema';
|
||||||
|
|||||||
Reference in New Issue
Block a user