Skip to content

Commit

Permalink
Use Diesels MultiConnections Derive
Browse files Browse the repository at this point in the history
With this PR we remove allmost all custom macro's to create the multiple
database type code. This is now handled by Diesel it self.

This removed the need of the following functions/macro's:
- `db_object!`
- `::to_db`
- `.from_db()`

All `conn` variables do not need a `mut` anymore (says nightly rust)

It is also possible to just use one schema instead of multiple per type.
  • Loading branch information
BlackDex committed Oct 21, 2023
1 parent 6eaf131 commit 1b1596c
Show file tree
Hide file tree
Showing 44 changed files with 1,908 additions and 2,926 deletions.
11 changes: 0 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ publish = false
build = "build.rs"

[features]
# default = ["sqlite"]
default = [
# "sqlite",
# "postgresql",
# "mysql",
]
# Empty to keep compatibility, prefer to set USE_SYSLOG=true
enable_syslog = []
mysql = ["diesel/mysql", "diesel_migrations/mysql"]
Expand All @@ -28,7 +32,7 @@ enable_mimalloc = ["mimalloc"]
# It enables the usage of the diesel_logger crate, which is able to output the generated queries.
# You also need to set an env variable `QUERY_LOGGER=1` to fully activate this so you do not have to re-compile
# if you want to turn off the logging for a specific run.
query_logger = ["diesel_logger"]
# query_logger = ["diesel_logger"] # Currently not able to be used with MultiConnection.

# Enable unstable features, requires nightly
# Currently only used to enable rusts official ip support
Expand Down Expand Up @@ -77,7 +81,7 @@ serde_json = "1.0.105"
# A safe, extensible ORM and Query builder
diesel = { version = "2.1.1", features = ["chrono", "r2d2"] }
diesel_migrations = "2.1.0"
diesel_logger = { version = "0.3.0", optional = true }
# diesel_logger = { version = "0.3.0", optional = true } # Currently not able to be used with MultiConnection.

# Bundled/Static SQLite
libsqlite3-sys = { version = "0.26.0", features = ["bundled"], optional = true }
Expand Down
164 changes: 85 additions & 79 deletions src/api/admin.rs

Large diffs are not rendered by default.

Loading

0 comments on commit 1b1596c

Please sign in to comment.