pub enum TableConstraint {
Unique(UniqueConstraint),
PrimaryKey(PrimaryKeyConstraint),
ForeignKey(ForeignKeyConstraint),
Check(CheckConstraint),
Index(IndexConstraint),
FulltextOrSpatial(FullTextOrSpatialConstraint),
}sql only.Expand description
A table-level constraint, specified in a CREATE TABLE or an
ALTER TABLE ADD <constraint> statement.
Variants§
Unique(UniqueConstraint)
MySQL definition for UNIQUE constraints statements:\
[CONSTRAINT [<name>]] UNIQUE <index_type_display> [<index_name>] [index_type] (<columns>) <index_options>
where:
- index_type is
USING {BTREE | HASH} - index_options is
{index_type | COMMENT 'string' | ... %currently unsupported stmts% } ... - index_type_display is
[INDEX | KEY]
PrimaryKey(PrimaryKeyConstraint)
MySQL definition for PRIMARY KEY constraints statements:\
[CONSTRAINT [<name>]] PRIMARY KEY [index_name] [index_type] (<columns>) <index_options>
Actually the specification have no [index_name] but the next query will complete successfully:
CREATE TABLE unspec_table (
xid INT NOT NULL,
CONSTRAINT p_name PRIMARY KEY index_name USING BTREE (xid)
);where:
- index_type is
USING {BTREE | HASH} - index_options is
{index_type | COMMENT 'string' | ... %currently unsupported stmts% } ...
ForeignKey(ForeignKeyConstraint)
A referential integrity constraint ([ CONSTRAINT <name> ] FOREIGN KEY (<columns>) REFERENCES <foreign_table> (<referred_columns>) { [ON DELETE <referential_action>] [ON UPDATE <referential_action>] | [ON UPDATE <referential_action>] [ON DELETE <referential_action>] }).
Check(CheckConstraint)
[ CONSTRAINT <name> ] CHECK (<expr>) [[NOT] ENFORCED]
Index(IndexConstraint)
MySQLs index definition for index creation. Not present on ANSI so, for now, the usage is restricted to MySQL, as no other dialects that support this syntax were found.
{INDEX | KEY} [index_name] [index_type] (key_part,...) [index_option]...
FulltextOrSpatial(FullTextOrSpatialConstraint)
Trait Implementations§
Source§impl Clone for TableConstraint
impl Clone for TableConstraint
Source§fn clone(&self) -> TableConstraint
fn clone(&self) -> TableConstraint
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TableConstraint
impl Debug for TableConstraint
Source§impl Display for TableConstraint
impl Display for TableConstraint
Source§impl From<CheckConstraint> for TableConstraint
impl From<CheckConstraint> for TableConstraint
Source§fn from(constraint: CheckConstraint) -> TableConstraint
fn from(constraint: CheckConstraint) -> TableConstraint
Source§impl From<ForeignKeyConstraint> for TableConstraint
impl From<ForeignKeyConstraint> for TableConstraint
Source§fn from(constraint: ForeignKeyConstraint) -> TableConstraint
fn from(constraint: ForeignKeyConstraint) -> TableConstraint
Source§impl From<FullTextOrSpatialConstraint> for TableConstraint
impl From<FullTextOrSpatialConstraint> for TableConstraint
Source§fn from(constraint: FullTextOrSpatialConstraint) -> TableConstraint
fn from(constraint: FullTextOrSpatialConstraint) -> TableConstraint
Source§impl From<IndexConstraint> for TableConstraint
impl From<IndexConstraint> for TableConstraint
Source§fn from(constraint: IndexConstraint) -> TableConstraint
fn from(constraint: IndexConstraint) -> TableConstraint
Source§impl From<PrimaryKeyConstraint> for TableConstraint
impl From<PrimaryKeyConstraint> for TableConstraint
Source§fn from(constraint: PrimaryKeyConstraint) -> TableConstraint
fn from(constraint: PrimaryKeyConstraint) -> TableConstraint
Source§impl From<UniqueConstraint> for TableConstraint
impl From<UniqueConstraint> for TableConstraint
Source§fn from(constraint: UniqueConstraint) -> TableConstraint
fn from(constraint: UniqueConstraint) -> TableConstraint
Source§impl Hash for TableConstraint
impl Hash for TableConstraint
Source§impl Ord for TableConstraint
impl Ord for TableConstraint
Source§fn cmp(&self, other: &TableConstraint) -> Ordering
fn cmp(&self, other: &TableConstraint) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for TableConstraint
impl PartialEq for TableConstraint
Source§impl PartialOrd for TableConstraint
impl PartialOrd for TableConstraint
Source§impl Spanned for TableConstraint
impl Spanned for TableConstraint
Source§impl Visit for TableConstraint
impl Visit for TableConstraint
Source§impl VisitMut for TableConstraint
impl VisitMut for TableConstraint
Source§fn visit<V>(&mut self, visitor: &mut V) -> ControlFlow<<V as VisitorMut>::Break>where
V: VisitorMut,
fn visit<V>(&mut self, visitor: &mut V) -> ControlFlow<<V as VisitorMut>::Break>where
V: VisitorMut,
VisitorMut. Read moreimpl Eq for TableConstraint
impl StructuralPartialEq for TableConstraint
Auto Trait Implementations§
impl Freeze for TableConstraint
impl RefUnwindSafe for TableConstraint
impl Send for TableConstraint
impl Sync for TableConstraint
impl Unpin for TableConstraint
impl UnsafeUnpin for TableConstraint
impl UnwindSafe for TableConstraint
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,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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