use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
#[sea_orm(table_name = "krate")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i64,
#[sea_orm(column_type = "Text", unique)]
pub name: String,
#[sea_orm(column_type = "Text")]
pub max_version: String,
pub total_downloads: i64,
#[sea_orm(column_type = "Text")]
pub last_updated: String,
#[sea_orm(column_type = "Text", nullable)]
pub description: Option<String>,
#[sea_orm(column_type = "Text", nullable)]
pub homepage: Option<String>,
#[sea_orm(column_type = "Text", nullable)]
pub repository: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::owner::Entity")]
Owner,
#[sea_orm(has_many = "super::crate_meta::Entity")]
CrateMeta,
}
impl Related<super::owner::Entity> for Entity {
fn to() -> RelationDef {
Relation::Owner.def()
}
}
impl Related<super::crate_meta::Entity> for Entity {
fn to() -> RelationDef {
Relation::CrateMeta.def()
}
}
impl ActiveModelBehavior for ActiveModel {}