Skip to content

Commit

Permalink
fix: remove file logic
Browse files Browse the repository at this point in the history
  • Loading branch information
akdasa committed Oct 28, 2024
1 parent 59def69 commit 2cd17ac
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions bake-database/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ const databases = [
]

for (const database of databases) {
console.log(`Processing ${database}...`)
const inputDB = new PouchDB(`${baseUri}${database}`)
const outputDB = new PouchDB(`./artifacts/${database}.db`, { adapter: 'websql' })


// Remove file if it exists
const path = `./artifacts/${database}.db`;
if (fs.existsSync(path)) {
console.log(`Removing ${database}...`)
fs.unlinkSync(path);
}

// Create the database
console.log(`Processing ${database}...`)
const inputDB = new PouchDB(`${baseUri}${database}`)
const outputDB = new PouchDB(`./artifacts/${database}.db`, { adapter: 'websql' })

// Replicate the database
inputDB.replicate.to(
outputDB, {
Expand Down

0 comments on commit 2cd17ac

Please sign in to comment.