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
|
|
|
|
2024-02-06 06:42:11 +08:00
|
|
|
db.version(3).stores({
|
2023-10-28 02:10:17 +08:00
|
|
|
diagrams: "++id, lastModified",
|
2023-12-19 10:36:10 +08:00
|
|
|
templates: "++id, custom",
|
2023-12-03 05:27:25 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
db.on("populate", (transaction) => {
|
|
|
|
transaction.templates.bulkAdd(templateSeeds).catch((e) => console.log(e));
|
2023-10-26 21:34:50 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
export { db };
|