kellnr_entity/
crate_meta.rs1use sea_orm::entity::prelude::*;
4
5#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
6#[sea_orm(table_name = "crate_meta")]
7pub struct Model {
8 #[sea_orm(primary_key)]
9 pub id: i64,
10 #[sea_orm(column_type = "Text")]
11 pub version: String,
12 #[sea_orm(column_type = "Text")]
13 pub created: String,
14 pub downloads: i64,
15 pub crate_fk: i64,
16 #[sea_orm(column_type = "Text", nullable)]
17 pub readme: Option<String>,
18 #[sea_orm(column_type = "Text", nullable)]
19 pub license: Option<String>,
20 #[sea_orm(column_type = "Text", nullable)]
21 pub license_file: Option<String>,
22 #[sea_orm(column_type = "Text", nullable)]
23 pub documentation: Option<String>,
24 pub size: i64,
25 #[sea_orm(column_type = "Text", nullable)]
26 pub publisher: Option<String>,
27 #[sea_orm(column_type = "Text", nullable)]
28 pub publisher_token: Option<String>,
29}
30
31#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
32pub enum Relation {
33 #[sea_orm(
34 belongs_to = "super::krate::Entity",
35 from = "Column::CrateFk",
36 to = "super::krate::Column::Id",
37 on_update = "NoAction",
38 on_delete = "Cascade"
39 )]
40 Krate,
41}
42
43impl Related<super::krate::Entity> for Entity {
44 fn to() -> RelationDef {
45 Relation::Krate.def()
46 }
47}
48
49impl ActiveModelBehavior for ActiveModel {}