Issue with create method with sqlx-crud crate

Hi guys,

this is my first topic here, so be patient! :grinning:

I have created an MVP on github here

Basically I have a simple sql table like this:

  id varchar(36) primary key not null,
  order_id varchar(36) unique not null

and I am using a test function in the MVP to create an entry in sql table with two Uuids, this is the function and the struct:

use sqlx::FromRow;
use sqlx_crud::SqlxCrud;
use uuid::Uuid;

#[derive(Debug, Clone, PartialEq, Eq, FromRow, SqlxCrud)]
pub struct TestDispute {
    pub id: Uuid,
    pub order_id: Uuid,

impl TestDispute {
    pub fn new(id: Uuid, order_id: Uuid) -> Self {
        Self { id, order_id }

fn main() {
    println!("Hello World!");

mod tests {
    use crate::TestDispute;
    use anyhow::Result;
    use sqlx::SqlitePool;
    use sqlx_crud::Crud;

    async fn test_new_dispute_fake() -> Result<()> {
        let db_url = "sqlite://mostro.db";

        let _poolaaa = SqlitePool::connect(&db_url).await?;

        let a = uuid::Uuid::new_v4();
        let b = uuid::Uuid::new_v4();
        let dispute = TestDispute::new(a, b);
        println!("{:?}", dispute);


calling the test with cargo I get:

running 1 test
test tests::test_new_dispute_fake ... FAILED


---- tests::test_new_dispute_fake stdout ----
TestDispute { id: 45b2294d-fafc-4043-87c7-4127ef9dbea4, order_id: a72b809d-3894-4579-9d2f-147493d3df19 }
Error: error returned from database: (code: 1299) NOT NULL constraint failed:

Caused by:
    (code: 1299) NOT NULL constraint failed:


I cannot get what I am missing, I put also this as an issue on the crate repo, could also be a bug.
Any advice is super appreciated!


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.