1use crate::db::ExtensionId;
2use sea_orm::entity::prelude::*;
3
4#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
5#[sea_orm(table_name = "extensions")]
6pub struct Model {
7 #[sea_orm(primary_key)]
8 pub id: ExtensionId,
9 pub external_id: String,
10 pub name: String,
11 pub latest_version: String,
12 pub total_download_count: i64,
13}
14
15#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
16pub enum Relation {
17 #[sea_orm(has_one = "super::extension_version::Entity")]
18 LatestVersion,
19}
20
21impl Related<super::extension_version::Entity> for Entity {
22 fn to() -> RelationDef {
23 Relation::LatestVersion.def()
24 }
25}
26
27impl ActiveModelBehavior for ActiveModel {}