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}
26
27#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
28pub enum Relation {
29 #[sea_orm(
30 belongs_to = "super::krate::Entity",
31 from = "Column::CrateFk",
32 to = "super::krate::Column::Id",
33 on_update = "NoAction",
34 on_delete = "Cascade"
35 )]
36 Krate,
37}
38
39impl Related<super::krate::Entity> for Entity {
40 fn to() -> RelationDef {
41 Relation::Krate.def()
42 }
43}
44
45impl ActiveModelBehavior for ActiveModel {}