kellnr_entity/
crate_index.rs1use sea_orm::entity::prelude::*;
4
5#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
6#[sea_orm(table_name = "crate_index")]
7pub struct Model {
8 #[sea_orm(primary_key)]
9 pub id: i64,
10 #[sea_orm(column_type = "Text")]
11 pub name: String,
12 #[sea_orm(column_type = "Text")]
13 pub vers: String,
14 #[sea_orm(column_type = "JsonBinary", nullable)]
15 pub deps: Option<Json>,
16 #[sea_orm(column_type = "Text")]
17 pub cksum: String,
18 #[sea_orm(column_type = "JsonBinary", nullable)]
19 pub features: Option<Json>,
20 pub yanked: bool,
21 #[sea_orm(column_type = "Text", nullable)]
22 pub links: Option<String>,
23 pub v: i32,
24 pub crate_fk: i64,
25 pub pubtime: Option<DateTime>,
26}
27
28#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
29pub enum Relation {
30 #[sea_orm(
31 belongs_to = "super::krate::Entity",
32 from = "Column::CrateFk",
33 to = "super::krate::Column::Id",
34 on_update = "NoAction",
35 on_delete = "Cascade"
36 )]
37 Krate,
38}
39
40impl Related<super::krate::Entity> for Entity {
41 fn to() -> RelationDef {
42 Relation::Krate.def()
43 }
44}
45
46impl ActiveModelBehavior for ActiveModel {}