Apostle Tree
Apostle Tree
Explore posts from servers
DTDrizzle Team
Created by Apostle Tree on 4/17/2024 in #help
Help with this error. "Can't find meta/_journal.json file"
Ohh ok. Ill do that then
22 replies
DTDrizzle Team
Created by Apostle Tree on 4/17/2024 in #help
Help with this error. "Can't find meta/_journal.json file"
Ah good idea. I was thinking abt it as well. Do you keep the db dir in the backend itself or create a separate dir for it(like client, db and backend)?
22 replies
DTDrizzle Team
Created by Apostle Tree on 4/17/2024 in #help
Help with this error. "Can't find meta/_journal.json file"
Ohh, I see. Well, it seems to be working fine now, so thnx!
22 replies
DTDrizzle Team
Created by Apostle Tree on 4/17/2024 in #help
Help with this error. "Can't find meta/_journal.json file"
Well, since schema.js is in the drizzle folder it self, i though simply writing migration as the pointed folder would be enough
22 replies
DTDrizzle Team
Created by Apostle Tree on 4/17/2024 in #help
Help with this error. "Can't find meta/_journal.json file"
Ah it works now! Although I have schema problems it seems, but the migrate is working
22 replies
DTDrizzle Team
Created by Apostle Tree on 4/17/2024 in #help
Help with this error. "Can't find meta/_journal.json file"
yes, thats how i get the .sql file and the journal file. But when I run db:migrate, it says it can't find the _journal.json file
22 replies
DTDrizzle Team
Created by Apostle Tree on 4/17/2024 in #help
Help with this error. "Can't find meta/_journal.json file"
Okie one sec, i am making some schema changes. Also a doubt, is it okay to drop migrations?
22 replies
DTDrizzle Team
Created by Apostle Tree on 4/17/2024 in #help
Help with this error. "Can't find meta/_journal.json file"
drizzle.config.js
const { defineConfig } = require("drizzle-kit");
require('dotenv').config();

module.exports = defineConfig({
schema: "./drizzle/schema.js",
out: "./drizzle/migrations",
driver: "pg",
dbCredentials: {
connectionString: process.env.NEON_DATABASE_URI
},
verbose: true,
strict: true
});
drizzle.config.js
const { defineConfig } = require("drizzle-kit");
require('dotenv').config();

module.exports = defineConfig({
schema: "./drizzle/schema.js",
out: "./drizzle/migrations",
driver: "pg",
dbCredentials: {
connectionString: process.env.NEON_DATABASE_URI
},
verbose: true,
strict: true
});
22 replies
DTDrizzle Team
Created by Apostle Tree on 4/17/2024 in #help
Help with this error. "Can't find meta/_journal.json file"
the migrations folder
22 replies
DTDrizzle Team
Created by Apostle Tree on 4/17/2024 in #help
Help with this error. "Can't find meta/_journal.json file"
But I do have a drizzle.config.js file
22 replies
DTDrizzle Team
Created by Apostle Tree on 4/17/2024 in #help
Help with this error. "Can't find meta/_journal.json file"
Alright! Here's my code for migrate.js
require('dotenv').config()
const { neon } = require('@neondatabase/serverless')
const { drizzle } = require('drizzle-orm/neon-http')
const { migrate } = require('drizzle-orm/neon-http/migrator')

const sql = neon(process.env.NEON_DATABASE_URI)
const db = drizzle(sql)

const main = async () => {
try {
await migrate(db, { migrationsFolder: "migrations" })
console.log("Migration completed")
} catch (error) {
console.error("Error during migration:", error)
process.exit(1)
}
}

main()
require('dotenv').config()
const { neon } = require('@neondatabase/serverless')
const { drizzle } = require('drizzle-orm/neon-http')
const { migrate } = require('drizzle-orm/neon-http/migrator')

const sql = neon(process.env.NEON_DATABASE_URI)
const db = drizzle(sql)

const main = async () => {
try {
await migrate(db, { migrationsFolder: "migrations" })
console.log("Migration completed")
} catch (error) {
console.error("Error during migration:", error)
process.exit(1)
}
}

main()
22 replies