-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Optimisation for schemas with many fields #4567
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
Closed
steven-supersolid
wants to merge
5
commits into
parse-community:master
from
supersolid:steven.large.schema.optimisation
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0391176
Modify fields instead of creating new object and copying fields
steven-supersolid ef82929
Remove redundant call to injectDefaultSchema. Fix modification of def…
steven-supersolid 68bc669
Merge branch 'master' into steven.large.schema.optimisation
steven-supersolid 1a6e3c1
Revert change to injectDefaultSchema. Remove additional call to injec…
steven-supersolid cbfb976
Add test for modifying schema. Demonstrate failure of other tests whe…
steven-supersolid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -320,7 +320,7 @@ const injectDefaultSchema = ({className, fields, classLevelPermissions, indexes} | |
...(defaultColumns[className] || {}), | ||
...fields, | ||
}, | ||
classLevelPermissions, | ||
classLevelPermissions | ||
}; | ||
if (indexes && Object.keys(indexes).length !== 0) { | ||
defaultSchema.indexes = indexes; | ||
|
@@ -330,26 +330,26 @@ const injectDefaultSchema = ({className, fields, classLevelPermissions, indexes} | |
|
||
const _HooksSchema = {className: "_Hooks", fields: defaultColumns._Hooks}; | ||
const _GlobalConfigSchema = { className: "_GlobalConfig", fields: defaultColumns._GlobalConfig } | ||
const _PushStatusSchema = convertSchemaToAdapterSchema(injectDefaultSchema({ | ||
const _PushStatusSchema = convertSchemaToAdapterSchema({ | ||
className: "_PushStatus", | ||
fields: {}, | ||
classLevelPermissions: {} | ||
})); | ||
const _JobStatusSchema = convertSchemaToAdapterSchema(injectDefaultSchema({ | ||
}); | ||
const _JobStatusSchema = convertSchemaToAdapterSchema({ | ||
className: "_JobStatus", | ||
fields: {}, | ||
classLevelPermissions: {} | ||
})); | ||
const _JobScheduleSchema = convertSchemaToAdapterSchema(injectDefaultSchema({ | ||
}); | ||
const _JobScheduleSchema = convertSchemaToAdapterSchema({ | ||
className: "_JobSchedule", | ||
fields: {}, | ||
classLevelPermissions: {} | ||
})); | ||
const _AudienceSchema = convertSchemaToAdapterSchema(injectDefaultSchema({ | ||
}); | ||
const _AudienceSchema = convertSchemaToAdapterSchema({ | ||
className: "_Audience", | ||
fields: defaultColumns._Audience, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistent and not required as convertSchemaToAdapterSchema calls injectDefaultSchema which adds these fields anyway |
||
fields: {}, | ||
classLevelPermissions: {} | ||
})); | ||
}); | ||
const VolatileClassesSchemas = [_HooksSchema, _JobStatusSchema, _JobScheduleSchema, _PushStatusSchema, _GlobalConfigSchema, _AudienceSchema]; | ||
|
||
const dbTypeMatchesObjectType = (dbType: SchemaField | string, objectType: SchemaField) => { | ||
|
@@ -407,7 +407,8 @@ export default class SchemaController { | |
const perms = {}; | ||
const indexes = {}; | ||
allSchemas.forEach(schema => { | ||
data[schema.className] = injectDefaultSchema(schema).fields; | ||
Object.freeze(schema.fields); | ||
data[schema.className] = schema.fields; | ||
perms[schema.className] = schema.classLevelPermissions; | ||
indexes[schema.className] = schema.indexes; | ||
}); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need to call injectDefaultSchema here as it is called inside convertSchemaToAdapterSchema