#[non_exhaustive]pub enum PrimaryKeyAdditionStrategy {
DeleteDuplicates {
keep: KeepPolicy,
},
}Expand description
How AddConstraint(PrimaryKey) should handle pre-existing
duplicate rows in the chosen column set.
KeepPolicy is reused from UniqueConstraintStrategy (F2) -
“First” / “Last” are defined by the table’s surviving primary-key
or row identity ordering. The cleanup SQL is emitted by
vespertide-query::sql::add_constraint::primary_key.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
DeleteDuplicates
Emit a DELETE statement ahead of ADD CONSTRAINT PRIMARY KEY
so only one row per group of new-PK duplicates survives.
Fields
keep: KeepPolicyWhich row of each duplicate group is preserved.
Trait Implementations§
Source§impl Clone for PrimaryKeyAdditionStrategy
impl Clone for PrimaryKeyAdditionStrategy
Source§fn clone(&self) -> PrimaryKeyAdditionStrategy
fn clone(&self) -> PrimaryKeyAdditionStrategy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PrimaryKeyAdditionStrategy
impl Debug for PrimaryKeyAdditionStrategy
Source§impl Default for PrimaryKeyAdditionStrategy
impl Default for PrimaryKeyAdditionStrategy
Source§fn default() -> Self
fn default() -> Self
Default strategy is DeleteDuplicates { keep: First }. Wire-
format omitted-field decodes to this value.
Wire-format breaking change vs v0.1.x. v0.1.x emitted no
pre-cleanup and let the database reject the migration. v0.2
emits a DELETE automatically. Already-applied migrations are
unaffected (apply happens once); v0.1.x migration files re-run
against a fresh DB now drop duplicate rows instead of failing.
Source§impl<'de> Deserialize<'de> for PrimaryKeyAdditionStrategy
impl<'de> Deserialize<'de> for PrimaryKeyAdditionStrategy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for PrimaryKeyAdditionStrategy
Source§impl Hash for PrimaryKeyAdditionStrategy
impl Hash for PrimaryKeyAdditionStrategy
Source§impl JsonSchema for PrimaryKeyAdditionStrategy
impl JsonSchema for PrimaryKeyAdditionStrategy
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Ord for PrimaryKeyAdditionStrategy
impl Ord for PrimaryKeyAdditionStrategy
Source§fn cmp(&self, other: &PrimaryKeyAdditionStrategy) -> Ordering
fn cmp(&self, other: &PrimaryKeyAdditionStrategy) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for PrimaryKeyAdditionStrategy
impl PartialEq for PrimaryKeyAdditionStrategy
Source§fn eq(&self, other: &PrimaryKeyAdditionStrategy) -> bool
fn eq(&self, other: &PrimaryKeyAdditionStrategy) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for PrimaryKeyAdditionStrategy
impl PartialOrd for PrimaryKeyAdditionStrategy
impl StructuralPartialEq for PrimaryKeyAdditionStrategy
Auto Trait Implementations§
impl Freeze for PrimaryKeyAdditionStrategy
impl RefUnwindSafe for PrimaryKeyAdditionStrategy
impl Send for PrimaryKeyAdditionStrategy
impl Sync for PrimaryKeyAdditionStrategy
impl Unpin for PrimaryKeyAdditionStrategy
impl UnsafeUnpin for PrimaryKeyAdditionStrategy
impl UnwindSafe for PrimaryKeyAdditionStrategy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more