#[cfg(feature = "with-serde")]
use serde::{Deserialize, Serialize};
use crate as sea_schema;
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
pub struct IndexInfo {
pub unique: bool,
pub name: String,
pub parts: Vec<IndexPart>,
pub nullable: bool,
pub idx_type: IndexType,
pub comment: String,
pub functional: bool,
}
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
pub struct IndexPart {
pub column: String,
pub order: IndexOrder,
pub sub_part: Option<u32>,
}
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
pub enum IndexOrder {
Ascending,
Descending,
Unordered,
}
#[derive(Clone, Debug, PartialEq, sea_query::Iden, sea_schema_derive::Name)]
#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
pub enum IndexType {
#[iden = "BTREE"]
BTree,
#[iden = "FULLTEXT"]
FullText,
#[iden = "HASH"]
Hash,
#[iden = "RTREE"]
RTree,
#[iden = "SPATIAL"]
Spatial,
}