Upgrade sea-orm
This commit is contained in:
parent
d3c411677a
commit
eec3df09be
2 changed files with 13 additions and 19 deletions
12
Cargo.lock
generated
12
Cargo.lock
generated
|
@ -3204,9 +3204,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libsqlite3-sys"
|
name = "libsqlite3-sys"
|
||||||
version = "0.25.1"
|
version = "0.25.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9f0455f2c1bc9a7caa792907026e469c1d91761fb0ea37cbb16427c77280cf35"
|
checksum = "29f835d03d717946d28b1d1ed632eb6f0e24a299388ee623d0c23118d3e8a7fa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
|
@ -5328,9 +5328,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sea-orm"
|
name = "sea-orm"
|
||||||
version = "0.10.4"
|
version = "0.10.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3120bc435b8640963ffda698f877610e07e077157e216eb99408d819c344034d"
|
checksum = "28fc9dad132e450d6320bd5953e70fb88b42785080b591e9be804da69bd8a170"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-stream",
|
"async-stream",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
@ -5356,9 +5356,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sea-orm-macros"
|
name = "sea-orm-macros"
|
||||||
version = "0.10.4"
|
version = "0.10.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c54bacfeb842813c16821e21f9456c358861a448294075184ea1d6307e386d08"
|
checksum = "66af5d33e04e56dafb2c700f9b1201a39e6c2c77b53ed9ee93244f21f8de6041"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bae",
|
"bae",
|
||||||
"heck 0.3.3",
|
"heck 0.3.3",
|
||||||
|
|
|
@ -23,9 +23,9 @@ use hyper::StatusCode;
|
||||||
use rpc::{proto, ConnectionId};
|
use rpc::{proto, ConnectionId};
|
||||||
pub use sea_orm::ConnectOptions;
|
pub use sea_orm::ConnectOptions;
|
||||||
use sea_orm::{
|
use sea_orm::{
|
||||||
entity::prelude::*, ActiveValue, ConnectionTrait, DatabaseBackend, DatabaseConnection,
|
entity::prelude::*, ActiveValue, ConnectionTrait, DatabaseConnection, DatabaseTransaction,
|
||||||
DatabaseTransaction, DbErr, FromQueryResult, IntoActiveModel, JoinType, QueryOrder,
|
DbErr, FromQueryResult, IntoActiveModel, IsolationLevel, JoinType, QueryOrder, QuerySelect,
|
||||||
QuerySelect, Statement, TransactionTrait,
|
Statement, TransactionTrait,
|
||||||
};
|
};
|
||||||
use sea_query::{Alias, Expr, OnConflict, Query};
|
use sea_query::{Alias, Expr, OnConflict, Query};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -2211,16 +2211,10 @@ impl Database {
|
||||||
F: Send + Fn(TransactionHandle) -> Fut,
|
F: Send + Fn(TransactionHandle) -> Fut,
|
||||||
Fut: Send + Future<Output = Result<T>>,
|
Fut: Send + Future<Output = Result<T>>,
|
||||||
{
|
{
|
||||||
let tx = self.pool.begin().await?;
|
let tx = self
|
||||||
|
.pool
|
||||||
// In Postgres, serializable transactions are opt-in
|
.begin_with_config(Some(IsolationLevel::Serializable), None)
|
||||||
if let DatabaseBackend::Postgres = self.pool.get_database_backend() {
|
|
||||||
tx.execute(Statement::from_string(
|
|
||||||
DatabaseBackend::Postgres,
|
|
||||||
"SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;".into(),
|
|
||||||
))
|
|
||||||
.await?;
|
.await?;
|
||||||
}
|
|
||||||
|
|
||||||
let mut tx = Arc::new(Some(tx));
|
let mut tx = Arc::new(Some(tx));
|
||||||
let result = f(TransactionHandle(tx.clone())).await;
|
let result = f(TransactionHandle(tx.clone())).await;
|
||||||
|
@ -2584,7 +2578,7 @@ mod test {
|
||||||
impl Drop for TestDb {
|
impl Drop for TestDb {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
let db = self.db.take().unwrap();
|
let db = self.db.take().unwrap();
|
||||||
if let DatabaseBackend::Postgres = db.pool.get_database_backend() {
|
if let sea_orm::DatabaseBackend::Postgres = db.pool.get_database_backend() {
|
||||||
db.runtime.as_ref().unwrap().block_on(async {
|
db.runtime.as_ref().unwrap().block_on(async {
|
||||||
use util::ResultExt;
|
use util::ResultExt;
|
||||||
let query = "
|
let query = "
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue