usar bun para db-datos

This commit is contained in:
Cat /dev/Nulo 2023-12-24 18:12:06 -03:00
parent 794247d657
commit 08f62c78db
2 changed files with 6 additions and 5 deletions

View file

@ -1,11 +1,11 @@
import { migrate } from "drizzle-orm/better-sqlite3/migrator"; import Database from "bun:sqlite";
import Database from "better-sqlite3"; import { drizzle } from "drizzle-orm/bun-sqlite";
import { drizzle } from "drizzle-orm/better-sqlite3"; import { migrate } from "drizzle-orm/bun-sqlite/migrator";
import * as schema from "./schema.js"; import * as schema from "./schema.js";
const sqlite = new Database("../scraper/sqlite.db"); const sqlite = new Database("../scraper/sqlite.db");
const db = drizzle(sqlite, { schema }); const db = drizzle(sqlite, { schema });
await migrate(db, { migrationsFolder: "./drizzle" }); migrate(db, { migrationsFolder: "./drizzle" });
sqlite.close(); sqlite.close();

View file

@ -5,7 +5,8 @@
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"migrate": "node --import tsx/esm migrate.ts" "migrate": "bun migrate.ts",
"generate": "drizzle-kit generate:sqlite"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",