-
Notifications
You must be signed in to change notification settings - Fork 43
Running migrations with '--dryrun' modifies the db sometimes. #31
Comments
Hmm. Are you sure you're only using the Expected to work every time// /project/migrations/v0.0.0__change.js
module.exports.migrate = async ({firestore, FieldValue}) => {
await firestore.collection('name').add({key: FieldValue.serverTimestamp()});
}; Could change things// /project/migrations/v0.0.0__change.js
const util = require('../util');
module.exports.migrate = async () => {
await util.change();
}; // /project/util.js
const { admin } = require('firebase-admin'); // this instance isn't guaranteed to be patched
const { firestore } = admin;
const { FieldValue } = firestore;
module.exports.change = async () => {
await firestore.collection('name').add({key: FieldValue.serverTimestamp()});
}; |
Heads up, if that is the problem, there may be a solution that could improve compatibility. Just lmk |
The setup is pretty much the same. I have been testing this again and the data is written to the DB without the |
👀 |
hey @kevlened, we have adapted our scripts to use the fireway-provided |
Hi @kiptoomm |
@42ae would you mind sharing a snippet showing the async calls you left open? Want to see what to avoid. |
@josheverett Given the following example, not returning
Hope this helps! Feel free to share your code if you need some insights. |
@42ae tried to reproduce your case but couldn't. Here is a test: josheverett@46bfacb Forcing the test to wait before the |
I noticed an inconsistency when running migration scripts with the
--dryrun
option.I was testing out my code to copy data from one collection to a new one. Whenever a change to the script was made, I ran the migration script which worked as expected on most occasions but made changes to the db sometimes.
The new collection is created and the supplied data is added.
The expected behaviour is that the new collection should not be created when using
--dryrun
.Command ran:
fireway migrate --dryrun
Fireway
[email protected]
Node:
v14.16.0
OS:
macOS Catalina
The text was updated successfully, but these errors were encountered: