Closed hasezoey closed 11 months ago
as this pr is a collection of fixes, i added some things i noticed while doing #114, namely:
diesel:PgConnection
does not actually exist (at least not anymore)tableA
while the import was table_a
)single-model-file
filesI'm going to add a few more commits here which should take care of some of the chnages which weren't included from #104
ah, I can't seem to do this. Do you mind adding the following changes?
Remove 'tsync' from Cargo.toml
In src/lib.rs
, add the following comment above pub connection_type: String,
:
/// For example:
/// - `diesel::pg::PgConnection` (default)
/// - `diesel::sqlite::SqliteConnection`
/// - `diesel::mysql::MysqlConnection`
/// - or, your custom diesel connection type (struct which implements `diesel::connection::Connection`)
src/lib.rs
, add a default for GenerationConfig before impl GenerationConfig<'_> {
impl<'a> Default for GenerationConfig<'a> {
fn default() -> Self {
Self {
table_options: Default::default(),
default_table_options: Default::default(),
connection_type: "diesel::pg::PgConnection".into(),
diesel_backend: "diesel::pg::Pg".into(),
schema_path: "crate::schema::".into(),
model_path: "crate::models::".into(),
once_common_structs: true,
once_connection_type: true,
}
}
}
Aaandddd, that should be all! 🙌
If you're not able to do this, no worries, I can add it in after we merge this in. Just let me know!
rebased on latest main, and added the 2.
for examples, removing the (default)
and adding r2d2, also adding that comment to the binary help.
i also changed the previous diesel::prelude::PgConnection
to diesel::pg::PgConnection
(as requested in https://github.com/Wulf/dsync/pull/114#discussion_r1398265444)
as for 1. remove tsync feature default
and 3. GenerationConfig default derive
, this should likely be done in a separate PR
(the tsync attribute is not added by default and would require a argument (--tsync
) in addition to having the feature enabled; generation config default derive would likely need some refactoring to make it work with good defaults (like connection_type
)
This PR is a small collection of fixes from #104, but refactored to current state dsync and separate from the other changes and not being based on #103, in more detail:
type ConnectionType
be public (was broken foronce-connection-type
)serde::
instead of requiring it to be imported (was broken foronce-common-structs
)these things would likely be catched earlier if the tests would actually be compile tested