sea_query/foreign_key/
mod.rs

1//! Foreign key definition & alternations statements.
2//!
3//! # Usage
4//!
5//! - Table Foreign Key Create, see [`ForeignKeyCreateStatement`]
6//! - Table Foreign Key Drop, see [`ForeignKeyDropStatement`]
7
8mod common;
9mod create;
10mod drop;
11
12pub use common::*;
13pub use create::*;
14pub use drop::*;
15
16/// Shorthand for constructing any foreign key statement
17#[derive(Debug, Clone)]
18pub struct ForeignKey;
19
20/// All available types of foreign key statement
21#[allow(clippy::large_enum_variant)]
22#[derive(Debug, Clone)]
23#[non_exhaustive]
24pub enum ForeignKeyStatement {
25    Create(ForeignKeyCreateStatement),
26    Drop(ForeignKeyDropStatement),
27}
28
29impl ForeignKey {
30    /// Construct foreign key [`ForeignKeyCreateStatement`]
31    pub fn create() -> ForeignKeyCreateStatement {
32        ForeignKeyCreateStatement::new()
33    }
34
35    /// Construct foreign key [`ForeignKeyDropStatement`]
36    pub fn drop() -> ForeignKeyDropStatement {
37        ForeignKeyDropStatement::new()
38    }
39}