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 #[sea_orm(column_type = "Text", nullable)]
27 pub rust_version: Option<String>,
28}
29
30#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
31pub enum Relation {
32 #[sea_orm(has_many = "super::crate_dependency::Entity")]
33 CrateDependency,
34 #[sea_orm(
35 belongs_to = "super::krate::Entity",
36 from = "Column::CrateFk",
37 to = "super::krate::Column::Id",
38 on_update = "NoAction",
39 on_delete = "Cascade"
40 )]
41 Krate,
42}
43
44impl Related<super::crate_dependency::Entity> for Entity {
45 fn to() -> RelationDef {
46 Relation::CrateDependency.def()
47 }
48}
49
50impl Related<super::krate::Entity> for Entity {
51 fn to() -> RelationDef {
52 Relation::Krate.def()
53 }
54}
55
56impl ActiveModelBehavior for ActiveModel {}