Why is it the case that my IDE says `await` does nothing on pretty much every single function?

I'm trying to setup a startup script that creates a local db and seeds it when I start my project. I'm running into an error where db is just not defined or has undefined columns. I'm debugging, and I can't help but notice that my IDE says await does nothing on the migrate function or any of the db.select() calls.
1 Reply
SteveS
SteveSOP6mo ago
I can't figure out any reason this wouldn't work:
import { Database } from "bun:sqlite"
import { $ } from "bun";
import { seedDb } from "./seed";
import { drizzle } from 'drizzle-orm/bun-sqlite';
import { usersTable } from "./src/lib/server/db/schema";

await $`rm -rf dev.db`

const sqlite = new Database("dev.db", {
readwrite: true,
create: true,
});

await $`bun drizzle-kit migrate`

const db = drizzle(sqlite);

console.log();

console.log("/n")
console.log("inserting test user");
await db.insert(usersTable).values({ id: "1", username: "test" });

console.log("getting test user");
const data = await db.select().from(usersTable);
await seedDb(sqlite);
import { Database } from "bun:sqlite"
import { $ } from "bun";
import { seedDb } from "./seed";
import { drizzle } from 'drizzle-orm/bun-sqlite';
import { usersTable } from "./src/lib/server/db/schema";

await $`rm -rf dev.db`

const sqlite = new Database("dev.db", {
readwrite: true,
create: true,
});

await $`bun drizzle-kit migrate`

const db = drizzle(sqlite);

console.log();

console.log("/n")
console.log("inserting test user");
await db.insert(usersTable).values({ id: "1", username: "test" });

console.log("getting test user");
const data = await db.select().from(usersTable);
await seedDb(sqlite);
Want results from more Discord servers?
Add your server