kevlened / fireway

A schema migration tool for firestore
MIT License
279 stars 41 forks source link

use with the firestore emulator #16

Closed kiptoomm closed 3 years ago

kiptoomm commented 3 years ago

Is there any way to use this library against a local instance of firestore running in the emulator? I'd love to test migration scripts against my local instance running at http://localhost:4000/firestore but when I do: fireway migrate

I get:

Found 2 migration files
ERROR: 9 FAILED_PRECONDITION: The Cloud Firestore API is not available for Cloud Datastore projects.

I thought that maybe it needs the --projectId option but I wouldn't know which 'project' to use since the target database is on a [locally] emulated instance. Any ideas?

kevlened commented 3 years ago

There is! We do this to test fireway itself. fireway is built on the firestore node library. If you define FIRESTORE_EMULATOR_HOST like we do here, the firestore node library will connect to your local instance (source). You shouldn't need a --projectId.

kiptoomm commented 3 years ago

There is! We do this to test fireway itself. fireway is built on the firestore node library. If you define FIRESTORE_EMULATOR_HOST like we do here, the firestore node library will connect to your local instance (source). You shouldn't need a --projectId.

Great, thank you! I went ahead and made a PR to improve the docs: https://github.com/kevlened/fireway/pull/17

kevlened commented 3 years ago

Thanks for the contribution!