-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Add Indexes to Schema API #4240
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ad9998a
Add Indexes to Schema API
dplewis e544c91
error handling
dplewis 8341390
ci errors
dplewis af01977
postgres support
dplewis 86aea28
full text compound indexes
dplewis ec2c0cb
pg clean up
dplewis 2904de3
get indexes on startup
dplewis d7b9ef9
Merge branch 'master' into schema-index
dplewis bf055fd
test compound index on startup
dplewis e251d44
add default _id to index, full Text index on startup
dplewis 95fd385
lint
dplewis 102af94
fix test
dplewis 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
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 |
---|---|---|
|
@@ -606,11 +606,14 @@ export class PostgresStorageAdapter { | |
}); | ||
} | ||
|
||
setIndexes(className, submittedIndexes, existingIndexes = {}, fields, conn) { | ||
setIndexesWithSchemaFormat(className, submittedIndexes, existingIndexes = {}, fields, conn) { | ||
conn = conn || this._client; | ||
if (submittedIndexes === undefined) { | ||
return Promise.resolve(); | ||
} | ||
if (Object.keys(existingIndexes).length === 0) { | ||
existingIndexes = { _id_: { _id: 1} }; | ||
} | ||
const deletedIndexes = []; | ||
const insertedIndexes = []; | ||
Object.keys(submittedIndexes).forEach(name => { | ||
|
@@ -658,7 +661,7 @@ export class PostgresStorageAdapter { | |
return this._client.tx(t => { | ||
const q1 = this.createTable(className, schema, t); | ||
const q2 = t.none('INSERT INTO "_SCHEMA" ("className", "schema", "isParseClass") VALUES ($<className>, $<schema>, true)', { className, schema }); | ||
const q3 = this.setIndexes(className, schema.indexes, {}, schema.fields, t); | ||
const q3 = this.setIndexesWithSchemaFormat(className, schema.indexes, {}, schema.fields, t); | ||
|
||
return t.batch([q1, q2, q3]); | ||
}) | ||
|
@@ -1251,6 +1254,7 @@ export class PostgresStorageAdapter { | |
} | ||
|
||
find(className, schema, query, { skip, limit, sort, keys }) { | ||
console.log('find'); | ||
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. here too |
||
debug('find', className, query, {skip, limit, sort, keys }); | ||
const hasLimit = limit !== undefined; | ||
const hasSkip = skip !== undefined; | ||
|
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
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.
log here should be removed