//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.17

use sea_orm::entity::prelude::*;

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "cratesio_index")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub id: i64,
    #[sea_orm(column_type = "Text")]
    pub name: String,
    #[sea_orm(column_type = "Text")]
    pub vers: String,
    #[sea_orm(column_type = "JsonBinary", nullable)]
    pub deps: Option<Json>,
    #[sea_orm(column_type = "Text")]
    pub cksum: String,
    #[sea_orm(column_type = "JsonBinary", nullable)]
    pub features: Option<Json>,
    #[sea_orm(column_type = "JsonBinary", nullable)]
    pub features2: Option<Json>,
    pub yanked: bool,
    #[sea_orm(column_type = "Text", nullable)]
    pub links: Option<String>,
    pub v: i32,
    pub crates_io_fk: i64,
    pub pubtime: Option<DateTime>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
    #[sea_orm(
        belongs_to = "super::cratesio_crate::Entity",
        from = "Column::CratesIoFk",
        to = "super::cratesio_crate::Column::Id",
        on_update = "NoAction",
        on_delete = "Cascade"
    )]
    CratesioCrate,
}

impl Related<super::cratesio_crate::Entity> for Entity {
    fn to() -> RelationDef {
        Relation::CratesioCrate.def()
    }
}

impl ActiveModelBehavior for ActiveModel {}
