Add generated database entity, just recipe and fix config table missing PK
This commit is contained in:
1
public/database/src/generated.rs
Normal file
1
public/database/src/generated.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub mod entities;
|
||||
19
public/database/src/generated/entities/config.rs
Normal file
19
public/database/src/generated/entities/config.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0.0-rc.18
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "config")]
|
||||
pub struct Model {
|
||||
#[sea_orm(unique, primary_key, auto_increment = false)]
|
||||
pub key: String,
|
||||
pub value: String,
|
||||
pub created_at: DateTimeUtc,
|
||||
pub updated_at: DateTimeUtc,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
6
public/database/src/generated/entities/mod.rs
Normal file
6
public/database/src/generated/entities/mod.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0.0-rc.18
|
||||
|
||||
pub mod prelude;
|
||||
|
||||
pub mod config;
|
||||
pub mod user;
|
||||
4
public/database/src/generated/entities/prelude.rs
Normal file
4
public/database/src/generated/entities/prelude.rs
Normal file
@@ -0,0 +1,4 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0.0-rc.18
|
||||
|
||||
pub use super::config::Entity as Config;
|
||||
pub use super::user::Entity as User;
|
||||
23
public/database/src/generated/entities/user.rs
Normal file
23
public/database/src/generated/entities/user.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0.0-rc.18
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "user")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
#[sea_orm(unique)]
|
||||
pub name: String,
|
||||
pub is_admin: bool,
|
||||
pub password_hash: String,
|
||||
pub salt: String,
|
||||
pub created_at: DateTimeUtc,
|
||||
pub updated_at: DateTimeUtc,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
@@ -1,5 +1,7 @@
|
||||
use sea_orm::ConnectOptions;
|
||||
|
||||
pub mod generated;
|
||||
|
||||
pub async fn get_connection<T: FnOnce(&mut ConnectOptions) -> &mut ConnectOptions>(
|
||||
connection_string: &str,
|
||||
option_fn: Option<T>,
|
||||
|
||||
Reference in New Issue
Block a user