Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(forms): start the protection-upgrade test from an empty public schema (#7674)

teo699c125bae8f
diff --git a/crates/forms/src/outbound/pg_forms_repo/test/protections.rs b/crates/forms/src/outbound/pg_forms_repo/test/protections.rs
index 8702146382..09c966e87e 100644
--- a/crates/forms/src/outbound/pg_forms_repo/test/protections.rs
+++ b/crates/forms/src/outbound/pg_forms_repo/test/protections.rs
@@ -1,6 +1,11 @@
use super::*;
use crate::domain::models::FormCreation;
+/// CI clones every test database from a `template1` that already holds the macrodb
+/// schema (`just setup_test_template`). This test replays migrations itself, so it
+/// starts from an empty `public` schema.
+const EMPTY_PUBLIC_SCHEMA: &str = "DROP SCHEMA public CASCADE; CREATE SCHEMA public;";
+
#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
async fn managed_column_cannot_be_deleted_while_its_form_exists(pool: PgPool) {
let table = insert_table(&pool).await;
@@ -245,6 +250,10 @@ async fn protection_upgrade_refuses_legacy_retyped_metadata_without_freezing_it(
),
..sqlx::migrate::Migrator::DEFAULT
};
+ sqlx::raw_sql(EMPTY_PUBLIC_SCHEMA)
+ .execute(&pool)
+ .await
+ .unwrap();
before_protections.run(&pool).await.unwrap();
let table = insert_table(&pool).await;
let form = form_over(&table);