the great renaming
This commit is contained in:
28
src/app/dexie/db.ts
Normal file
28
src/app/dexie/db.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import Dexie, { type EntityTable } from 'dexie';
|
||||
import { Food } from '../types/food';
|
||||
import { FOODS } from './entities/foods';
|
||||
import { CHIBIS } from './entities/chibis';
|
||||
import { Chibi } from '../types/chibi/chibi';
|
||||
|
||||
|
||||
|
||||
const db = new Dexie('ChibiCollector') as Dexie & {
|
||||
chibis: EntityTable<Chibi, 'id'>;
|
||||
foods: EntityTable<Food, 'id'>;
|
||||
};
|
||||
|
||||
db.version(1).stores({
|
||||
chibis: '++id',
|
||||
foods: '++id',
|
||||
});
|
||||
|
||||
//db.delete();
|
||||
|
||||
// Populate with sample data on first run
|
||||
db.on('populate', async () => {
|
||||
await db.chibis.bulkAdd(CHIBIS);
|
||||
await db.foods.bulkAdd(FOODS);
|
||||
|
||||
});
|
||||
|
||||
export { db };
|
||||
Reference in New Issue
Block a user