Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce a schema or data shape on import #5

Open
codediodeio opened this issue Mar 31, 2018 · 2 comments
Open

Enforce a schema or data shape on import #5

codediodeio opened this issue Mar 31, 2018 · 2 comments

Comments

@codediodeio
Copy link
Owner

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

@stildalf
Copy link
Contributor

stildalf commented Apr 1, 2018

I like. This will indeed be necessary to encode/decode some Firestore specific types, like geopoint.

@basementaspirations
Copy link

where is the schema defined? in a file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants