Add test cases
This commit is contained in:
parent
88776a28ed
commit
89806ef522
@ -6,6 +6,7 @@ use crate::entity::prelude::*;
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
#[sea_orm(column_name = "name", enum_name = "Name")]
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,8 @@ use sea_orm::entity::prelude::*;
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub uuid: Uuid,
|
||||
#[sea_orm(column_name = "type", enum_name = "Type")]
|
||||
pub ty: String,
|
||||
pub key: String,
|
||||
pub value: String,
|
||||
pub bytes: Vec<u8>,
|
||||
|
@ -283,6 +283,7 @@ pub async fn create_metadata_table(db: &DbConn) -> Result<ExecResult, DbErr> {
|
||||
.not_null()
|
||||
.primary_key(),
|
||||
)
|
||||
.col(ColumnDef::new(metadata::Column::Type).string().not_null())
|
||||
.col(ColumnDef::new(metadata::Column::Key).string().not_null())
|
||||
.col(ColumnDef::new(metadata::Column::Value).string().not_null())
|
||||
.col(ColumnDef::new(metadata::Column::Bytes).binary().not_null())
|
||||
|
@ -22,18 +22,21 @@ pub async fn crud_in_parallel(db: &DatabaseConnection) -> Result<(), DbErr> {
|
||||
let metadata = vec![
|
||||
metadata::Model {
|
||||
uuid: Uuid::new_v4(),
|
||||
ty: "Type".to_owned(),
|
||||
key: "markup".to_owned(),
|
||||
value: "1.18".to_owned(),
|
||||
bytes: vec![1, 2, 3],
|
||||
},
|
||||
metadata::Model {
|
||||
uuid: Uuid::new_v4(),
|
||||
ty: "Type".to_owned(),
|
||||
key: "exchange_rate".to_owned(),
|
||||
value: "0.78".to_owned(),
|
||||
bytes: vec![1, 2, 3],
|
||||
},
|
||||
metadata::Model {
|
||||
uuid: Uuid::new_v4(),
|
||||
ty: "Type".to_owned(),
|
||||
key: "service_charge".to_owned(),
|
||||
value: "1.1".to_owned(),
|
||||
bytes: vec![1, 2, 3],
|
||||
|
@ -20,6 +20,7 @@ async fn main() -> Result<(), DbErr> {
|
||||
pub async fn create_metadata(db: &DatabaseConnection) -> Result<(), DbErr> {
|
||||
let metadata = metadata::Model {
|
||||
uuid: Uuid::new_v4(),
|
||||
ty: "Type".to_owned(),
|
||||
key: "markup".to_owned(),
|
||||
value: "1.18".to_owned(),
|
||||
bytes: vec![1, 2, 3],
|
||||
|
Loading…
x
Reference in New Issue
Block a user