drawDB/src/data/db.js

16 lines
319 B
JavaScript
Raw Normal View History

2023-10-26 21:34:50 +08:00
import Dexie from "dexie";
2023-12-03 05:27:25 +08:00
import { templateSeeds } from "./seeds";
2023-10-26 21:34:50 +08:00
2023-10-27 01:26:13 +08:00
const db = new Dexie("drawDB");
2023-10-26 21:34:50 +08:00
2023-12-03 05:27:25 +08:00
db.version(2).stores({
2023-10-28 02:10:17 +08:00
diagrams: "++id, lastModified",
2023-12-03 05:27:25 +08:00
templates: "++id",
});
db.on("populate", (transaction) => {
transaction.templates.bulkAdd(templateSeeds).catch((e) => console.log(e));
2023-10-26 21:34:50 +08:00
});
export { db };