Skip to content

Commit

Permalink
Merge pull request #196 from sebadob/fix-scopes-migration
Browse files Browse the repository at this point in the history
Fix scopes migration
  • Loading branch information
sebadob authored Dec 1, 2023
2 parents 462f2d3 + b6bb682 commit 46d0455
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
9 changes: 5 additions & 4 deletions rauthy-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
//! with the least amount of overhead and secure default values, if you only use
//! [Rauthy](https://github.com/sebadob/rauthy) anyway.
//!
//! This client should work without any issues with other OIDC providers as well, as long as they
//! support the S256 PKCE flow. However, this was only tested against
//! [Rauthy](https://github.com/sebadob/rauthy).
//!
//! You can find examples for `actix-web`, `axum` or a fully generic framework / application in the
//! [Examples](https://github.com/sebadob/rauthy/tree/main/rauthy-client/examples) directory.
//!
//! # Features
//!
//! - `actix-web` will enable actix-web specific extractors and handlers
//! - `axum` will enable axum specific extractors and handlers

use crate::provider::OidcProvider;
use base64::{engine, engine::general_purpose, Engine as _};
Expand Down
26 changes: 16 additions & 10 deletions rauthy-models/src/migration/db_migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,11 +533,14 @@ pub async fn migrate_from_sqlite(
.await?;
sqlx::query("delete from scopes").execute(db_to).await?;
for b in before {
sqlx::query("insert into scopes (id, name) values ($1, $2)")
.bind(b.id)
.bind(b.name)
.execute(db_to)
.await?;
sqlx::query(
r#"insert into scopes (id, name, attr_include_access, attr_include_id)
values ($1, $2, $3, $4)"#,
)
.bind(b.id)
.bind(b.name)
.execute(db_to)
.await?;
}

// USER ATTR CONFIG
Expand Down Expand Up @@ -907,11 +910,14 @@ pub async fn migrate_from_postgres(
.await?;
sqlx::query("delete from scopes").execute(db_to).await?;
for b in before {
sqlx::query("insert into scopes (id, name) values ($1, $2)")
.bind(b.id)
.bind(b.name)
.execute(db_to)
.await?;
sqlx::query(
r#"insert into scopes (id, name, attr_include_access, attr_include_id)
values ($1, $2, $3, $4)"#,
)
.bind(b.id)
.bind(b.name)
.execute(db_to)
.await?;
}

// USER ATTR CONFIG
Expand Down

0 comments on commit 46d0455

Please sign in to comment.