diff --git a/backend/migrations/20230524065919_fix_migration_break.down.sql b/backend/migrations/20230524065919_fix_migration_break.down.sql new file mode 100644 index 0000000000..d2f607c5b8 --- /dev/null +++ b/backend/migrations/20230524065919_fix_migration_break.down.sql @@ -0,0 +1 @@ +-- Add down migration script here diff --git a/backend/migrations/20230524065919_fix_migration_break.up.sql b/backend/migrations/20230524065919_fix_migration_break.up.sql new file mode 100644 index 0000000000..f4db3117a1 --- /dev/null +++ b/backend/migrations/20230524065919_fix_migration_break.up.sql @@ -0,0 +1,11 @@ +-- Add up migration script here +do + $$ +BEGIN + +IF (NOT EXISTS (SELECT workspace_id FROM script WHERE workspace_id = 'demo' UNION ALL SELECT workspace_id FROM flow WHERE workspace_id = 'demo' UNION ALL SELECT workspace_id FROM app WHERE workspace_id = 'demo')) +THEN + DELETE FROM workspace_invite WHERE workspace_id = 'demo'; +END IF; +END +$$ diff --git a/backend/src/main.rs b/backend/src/main.rs index 4dd4a8f312..c0dbd6a26d 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -99,6 +99,7 @@ async fn main() -> anyhow::Result<()> { }; if server_mode { + // migration code to avoid break windmill_api::migrate_db(&db).await?; }