Skip to content

Commit

Permalink
chore: create script for migrating data from staging to production
Browse files Browse the repository at this point in the history
Closes #187
  • Loading branch information
stdavis committed Jun 10, 2024
1 parent db6d1b0 commit b55f443
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions scripts/staging-to-production.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Firestore } from '@google-cloud/firestore';

// update production firestore database from staging database

const staging = new Firestore();

const production = new Firestore({
projectId: '<project-id>',
});

const stagingAccounts = await staging.collection('accounts').get();

for (const doc of stagingAccounts.docs) {
const data = doc.data();
console.log(`Seeding staging account ${doc.id}`);
await production.collection('accounts').doc(doc.id).set(data);
}

0 comments on commit b55f443

Please sign in to comment.