rieter/server/src/db/entities/package.rs

94 lines
2.4 KiB
Rust

//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(table_name = "package")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
pub repo_id: i32,
pub base: String,
pub name: String,
pub version: String,
pub arch: String,
pub size: i64,
pub c_size: i64,
pub description: Option<String>,
pub url: Option<String>,
pub build_date: DateTime,
pub packager: Option<String>,
pub pgp_sig: Option<String>,
pub pgp_sig_size: Option<i64>,
pub sha256_sum: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::package_conflicts::Entity")]
PackageConflicts,
#[sea_orm(has_many = "super::package_depends::Entity")]
PackageDepends,
#[sea_orm(has_many = "super::package_group::Entity")]
PackageGroup,
#[sea_orm(has_many = "super::package_license::Entity")]
PackageLicense,
#[sea_orm(has_many = "super::package_provides::Entity")]
PackageProvides,
#[sea_orm(has_many = "super::package_replaces::Entity")]
PackageReplaces,
#[sea_orm(
belongs_to = "super::repo::Entity",
from = "Column::RepoId",
to = "super::repo::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
Repo,
}
impl Related<super::package_conflicts::Entity> for Entity {
fn to() -> RelationDef {
Relation::PackageConflicts.def()
}
}
impl Related<super::package_depends::Entity> for Entity {
fn to() -> RelationDef {
Relation::PackageDepends.def()
}
}
impl Related<super::package_group::Entity> for Entity {
fn to() -> RelationDef {
Relation::PackageGroup.def()
}
}
impl Related<super::package_license::Entity> for Entity {
fn to() -> RelationDef {
Relation::PackageLicense.def()
}
}
impl Related<super::package_provides::Entity> for Entity {
fn to() -> RelationDef {
Relation::PackageProvides.def()
}
}
impl Related<super::package_replaces::Entity> for Entity {
fn to() -> RelationDef {
Relation::PackageReplaces.def()
}
}
impl Related<super::repo::Entity> for Entity {
fn to() -> RelationDef {
Relation::Repo.def()
}
}
impl ActiveModelBehavior for ActiveModel {}