Skip to content

Missing use super::*; inside nested (PostgreSQL) schema module #74

@teohhanhui

Description

@teohhanhui

If you have in diesel.toml:

[print_schema]
file = "src/schema.rs"
schema = "foo"

And you do:

diesel print-schema > src/schema.rs

You'd get in src/schema.rs:

pub mod foo {
    // ... schema types here ...
}

Then you proceed to do:

diesel_ext --model --import-types 'crate::schema::*' --add-table-name > src/models.rs

Expected src/models.rs

use crate::schema::*;

use chrono::NaiveDateTime;
use bigdecimal::BigDecimal;
use uuid::Uuid;
use diesel::prelude::*;
pub mod foo {
    use super::*;

    // ... model structs here ...

}

Actual src/models.rs

use crate::schema::*;

use chrono::NaiveDateTime;
use bigdecimal::BigDecimal;
use uuid::Uuid;
use diesel::prelude::*;
pub mod foo {
    // no `use super::*;` here

    // ... model structs here ...

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions