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