-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Use the specified the index name above the default name #60
base: main
Are you sure you want to change the base?
Conversation
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.
A couple concerns
func prepare(on database: Database) -> EventLoopFuture<Void> { | ||
database | ||
.schema("index-tests") | ||
.field("name", .string, .required) |
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.
.field("name", .string, .required) | |
.compositeIdentifier(over: "name", "email") | |
.field("name", .string, .required) |
In light of my remarks above (and since it'll just translate to an additional unique index for Mongo)
@@ -146,6 +146,10 @@ final class FluentMongoDriverTests: XCTestCase { | |||
XCTFail("\(error)") | |||
} | |||
} | |||
|
|||
func testDuplicateIndexNames() throws { | |||
XCTAssertNoThrow(try DuplicateIndexMigration().prepare(on: self.db).wait()) |
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.
IIUC this won't actually test anything; the original reporter said in Discord that only one index gets created, not that an error is thrown. Is there a way to verify the indexes were actually added? Or alternatively, can we either 1) check for duplicates and throw an error in the schema logic, or 2) ask MongoDB to reject duplicates somehow?
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #60 +/- ##
==========================================
+ Coverage 72.59% 73.05% +0.46%
==========================================
Files 20 20
Lines 686 694 +8
==========================================
+ Hits 498 507 +9
+ Misses 188 187 -1
|
No description provided.