feat: implemented a basic store and emulatorjs

This commit is contained in:
Simeon Radivoev 2026-03-14 02:15:57 +02:00
parent 2f32cbc730
commit 7286541822
Signed by: simeonradivoev
GPG key ID: 7611A451D2A5D37A
121 changed files with 5900 additions and 1092 deletions

View file

@ -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"),

View 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(),
})
};

View file

@ -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],
}),