firestore-migrator
firestore-migrator copied to clipboard
Enforce a schema or data shape on import
Imagine you have a huge spreadsheet with many unnecessary fields or unwanted data types, you could define an object that would convert the data to the proper Firestore structure and set defaults for missing vals.
export const item = new Schema({
name: { type: 'string', default: 'hello' }
location: { type: 'geopoint' }
date: { type: 'timestamp', default: new Date() }
})
Then you run a command like fire-migrate items.csv items --schema item
I like. This will indeed be necessary to encode/decode some Firestore specific types, like geopoint.
where is the schema defined? in a file?