From 39351d3fb8e411ecfc7c6b050024ef0ec6fc84b0 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sat, 5 Nov 2022 10:45:17 +0100 Subject: [PATCH] remove initial invite to demo for ruben@windmill.dev --- .../migrations/20221105003256_grant_all.down.sql | 1 + backend/migrations/20221105003256_grant_all.up.sql | 13 +++++++++++++ backend/windmill-api/src/oauth2.rs | 7 +++++-- 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 backend/migrations/20221105003256_grant_all.down.sql create mode 100644 backend/migrations/20221105003256_grant_all.up.sql diff --git a/backend/migrations/20221105003256_grant_all.down.sql b/backend/migrations/20221105003256_grant_all.down.sql new file mode 100644 index 0000000000..d2f607c5b8 --- /dev/null +++ b/backend/migrations/20221105003256_grant_all.down.sql @@ -0,0 +1 @@ +-- Add down migration script here diff --git a/backend/migrations/20221105003256_grant_all.up.sql b/backend/migrations/20221105003256_grant_all.up.sql new file mode 100644 index 0000000000..916fdcbbfb --- /dev/null +++ b/backend/migrations/20221105003256_grant_all.up.sql @@ -0,0 +1,13 @@ +-- Add up migration script here + + +GRANT ALL +ON ALL TABLES IN SCHEMA public +TO windmill_user; + + +GRANT ALL +ON ALL TABLES IN SCHEMA public +TO windmill_admin; + +DELETE FROM workspace_invite WHERE workspace_id = 'demo' AND email = 'ruben@windmill.dev'; \ No newline at end of file diff --git a/backend/windmill-api/src/oauth2.rs b/backend/windmill-api/src/oauth2.rs index fd6d2f5b90..e3798ca1af 100644 --- a/backend/windmill-api/src/oauth2.rs +++ b/backend/windmill-api/src/oauth2.rs @@ -802,14 +802,17 @@ async fn login_callback( .await? .unwrap_or(false); if demo_exists { - sqlx::query!( + if let Err(e) = sqlx::query!( "INSERT INTO workspace_invite (workspace_id, email, is_admin) VALUES ('demo', $1, false)", &email ) .execute(&mut tx) - .await?; + .await + { + tracing::error!("error inserting invite: {:#?}", e); + } } } tx.commit().await?;