feat: implemented a basic store and emulatorjs
This commit is contained in:
parent
2f32cbc730
commit
7286541822
121 changed files with 5900 additions and 1092 deletions
|
|
@ -3,7 +3,7 @@ import { integer, text, sqliteTable, blob } from "drizzle-orm/sqlite-core";
|
|||
|
||||
export const games = sqliteTable('games', {
|
||||
id: integer('id').primaryKey({ autoIncrement: true }),
|
||||
source_id: integer('source_id').unique(),
|
||||
source_id: text('source_id'),
|
||||
source: text("source"),
|
||||
igdb_id: integer("igdb_id").unique(),
|
||||
name: text("name"),
|
||||
|
|
|
|||
10
src/bun/api/schema/cache.ts
Normal file
10
src/bun/api/schema/cache.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
||||
|
||||
export default {
|
||||
item_cache: sqliteTable('item_cache', {
|
||||
key: text('key').primaryKey(),
|
||||
data: text('data', { mode: 'json' }).notNull(),
|
||||
expire_at: integer("expire_at", { mode: 'timestamp' }).notNull(),
|
||||
updated_at: integer("updated_at", { mode: 'timestamp' }).notNull(),
|
||||
})
|
||||
};
|
||||
|
|
@ -29,6 +29,10 @@ export const systemMappings = sqliteTable('systemMappings', {
|
|||
system: text().notNull().references(() => systems.name)
|
||||
});
|
||||
|
||||
export const systemMappingsRelations = relations(systemMappings, ({ one }) => ({
|
||||
system: one(systems, { fields: [systemMappings.system], references: [systems.name] })
|
||||
}));
|
||||
|
||||
export const commands = sqliteTable('commands', {
|
||||
system: text().references(() => systems.name, { onDelete: 'cascade', onUpdate: 'cascade' }),
|
||||
label: text(),
|
||||
|
|
@ -36,7 +40,7 @@ export const commands = sqliteTable('commands', {
|
|||
});
|
||||
|
||||
export const commandsRelations = relations(commands, ({ one }) => ({
|
||||
author: one(systems, {
|
||||
system: one(systems, {
|
||||
fields: [commands.system],
|
||||
references: [systems.name],
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue