-
-
Notifications
You must be signed in to change notification settings - Fork 2
Add options to either ignore or remove unknown migrations #3
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
Conversation
54fe2b3 to
1f135a2
Compare
f0401c1 to
14601cc
Compare
| public struct ApplyOptions: OptionSet, Sendable { | ||
| public let rawValue: Int | ||
|
|
||
| public init(rawValue: Int) { self.rawValue = rawValue } | ||
|
|
||
| /// If database has a migration applied we don't know about, ignore it | ||
| static var ignoreUnknownMigrations: Self { .init(rawValue: 1 << 0) } | ||
| } |
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.
Can we make this not backed by a raw value? I think we'll want to consider options that are not a single flag/boolean, but with an associatedvalue
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.
If we are to use OptionSet, it conforms to RawRepresentable
| public struct RevertOptions: OptionSet, Sendable { | ||
| public let rawValue: Int | ||
|
|
||
| public init(rawValue: Int) { self.rawValue = rawValue } | ||
|
|
||
| /// Ignore migrations we don't know about | ||
| static var ignoreUnknownMigrations: Self { .init(rawValue: 1 << 0) } | ||
| /// Remove database entry for migrations we don't know about | ||
| static var removeUnknownMigrations: Self { .init(rawValue: 1 << 1) } | ||
| } |
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.
Same here
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3 +/- ##
=======================================
Coverage 92.22% 92.22%
=======================================
Files 4 4
Lines 450 450
=======================================
Hits 415 415
Misses 35 35 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add new options parameter to
apply,revertandrevertInconsistent.applyhas option.ignoreUnknownMigrationsreverthas options.ignoreUnknownMigrationsand.removeUnknownMigrationsrevertInconsistenthas options.ignoreUnknownMigrationsand.removeUnknownMigrationsAlso added
Migrations.add(_:skipDuplicates:)which takessome Collection<any DatabaseMigration>