kellnr_entity/
cratesio_crate.rs1use sea_orm::entity::prelude::*;
4
5#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
6#[sea_orm(table_name = "cratesio_crate")]
7pub struct Model {
8 #[sea_orm(primary_key)]
9 pub id: i64,
10 #[sea_orm(column_type = "Text", unique)]
11 pub name: String,
12 #[sea_orm(column_type = "Text", unique)]
13 pub original_name: String,
14 pub e_tag: String,
15 #[sea_orm(column_type = "Text")]
16 pub last_modified: String,
17 #[sea_orm(column_type = "Text", nullable)]
18 pub description: Option<String>,
19 pub total_downloads: i64,
20 #[sea_orm(column_type = "Text")]
21 pub max_version: String,
22}
23
24#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
25pub enum Relation {
26 #[sea_orm(has_many = "super::cratesio_index::Entity")]
27 CratesioIndex,
28 #[sea_orm(has_many = "super::cratesio_meta::Entity")]
29 CratesioMeta,
30}
31
32impl Related<super::cratesio_index::Entity> for Entity {
33 fn to() -> RelationDef {
34 Relation::CratesioIndex.def()
35 }
36}
37
38impl Related<super::cratesio_meta::Entity> for Entity {
39 fn to() -> RelationDef {
40 Relation::CratesioMeta.def()
41 }
42}
43
44impl ActiveModelBehavior for ActiveModel {}