Help with migration
Hello, super new to discord, neon, and drizzle.
Using drizzle and neon, trying to update the table in neon to add a new column to a table. I updated the schema, and then ran npm run db:generate - successfully created a migration file in my migrations folder "0006_warm_omega_flight.sql". Tried to run npm run db:migrate and got this error:
❌ Migration failed
Error: No file migrations/0000_left_romulus.sql found in migrations folder
It looks like it's looking for the wrong migration file. How do I tell it to use the 0006 file?
4 Replies
adverse-sapphire•2y ago
Did you delete the old migrations by mistake? Drizzle keeps a journal of all the files.
You may be able to delete the reference to
0000_left_romulus.sql in the journal.json and retry. I don't know much about Drizzle internals though, so this could cause issues.rising-crimson•2y ago
hmm, how are you configuring drizzle? Are you using a config file?
correct-apricotOP•2y ago
yes - a drizzle.congif.ts file
import { defineConfig } from "drizzle-kit";
import { env } from "@/env";
export default defineConfig({
dbCredentials: {
connectionString: env.DATABASE_URL,
},
driver: "pg",
out: "./migrations",
schema: "./src/interfaces/neon/schema.ts",
});
rising-crimson•2y ago
Hmm, what does your db:migrate commadn look like