can store and retrive data now lol ok xd
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "channel")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
pub id_discord: i32,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(has_many = "super::messages::Entity")]
|
||||
Messages,
|
||||
}
|
||||
|
||||
impl Related<super::messages::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Messages.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
pub mod prelude;
|
||||
|
||||
pub mod channel;
|
||||
pub mod content;
|
||||
pub mod members;
|
||||
pub mod messages;
|
||||
|
||||
@@ -10,11 +10,20 @@ pub struct Model {
|
||||
pub id_discord: i32,
|
||||
pub id_sender: i32,
|
||||
pub id_content: i32,
|
||||
pub id_channel: i32,
|
||||
pub id_server: i32,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::channel::Entity",
|
||||
from = "Column::IdChannel",
|
||||
to = "super::channel::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "NoAction"
|
||||
)]
|
||||
Channel,
|
||||
#[sea_orm(
|
||||
belongs_to = "super::content::Entity",
|
||||
from = "Column::IdContent",
|
||||
@@ -25,6 +34,12 @@ pub enum Relation {
|
||||
Content,
|
||||
}
|
||||
|
||||
impl Related<super::channel::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Channel.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::content::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Content.def()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19
|
||||
|
||||
pub use super::channel::Entity as Channel;
|
||||
pub use super::content::Entity as Content;
|
||||
pub use super::members::Entity as Members;
|
||||
pub use super::messages::Entity as Messages;
|
||||
|
||||
Reference in New Issue
Block a user