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

firebase2graphql (v0.0.2): support array types in firebase json (close #1829) #1900

Merged
merged 8 commits into from
Apr 3, 2019
Prev Previous commit
Next Next commit
improve error message and use json type if the type os object or array
  • Loading branch information
wawhal committed Mar 28, 2019
commit 3956e7dc1b60d8f168fd4251f3074a8e678eac80
4 changes: 2 additions & 2 deletions community/tools/firebase2graphql/src/import/generateTables.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ const getDataType = (data, column) => {
if (data.constructor.name === 'Date') {
return 'timestamptz';
}
if (data.constructor.name === 'Object') {
if (data.constructor.name === 'Object' || data.constructor.name === 'Array') {
return 'json';
}
throwError(`Message: invalid data type given for column ${column}: ${typeof data}`);
throwError(`Message: invalid data type given for column ${column}: ${data.constructor.name}`);
};

const isForeign = (name, db) => {
Expand Down