From 07873b46383a285699a2e2abf2e0c0a29307d908 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Thu, 8 Aug 2024 11:14:07 -0400 Subject: [PATCH] Added failing test for AutoRefresh triggers --- Test/IDE/CodeGeneration/MigrationGenerator.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Test/IDE/CodeGeneration/MigrationGenerator.hs b/Test/IDE/CodeGeneration/MigrationGenerator.hs index abe4ad431..b4b87cfa0 100644 --- a/Test/IDE/CodeGeneration/MigrationGenerator.hs +++ b/Test/IDE/CodeGeneration/MigrationGenerator.hs @@ -1362,6 +1362,17 @@ CREATE POLICY "Users can read and edit their own record" ON public.users USING ( diffSchemas targetSchema actualSchema `shouldBe` migration + it "should ignore ar_did_update_.. triggers by IHP.AutoRefresh" do + let actualSchema = sql $ cs [plain| + CREATE TRIGGER ar_did_update_plans AFTER UPDATE ON public.plans FOR EACH ROW EXECUTE FUNCTION public.notify_did_change_plans(); + CREATE TRIGGER ar_did_insert_offices AFTER INSERT ON public.offices FOR EACH STATEMENT EXECUTE FUNCTION public.notify_did_change_offices(); + CREATE TRIGGER ar_did_delete_company_profiles AFTER DELETE ON public.company_profiles FOR EACH STATEMENT EXECUTE FUNCTION public.notify_did_change_company_profiles(); + |] + let targetSchema = [] + let migration = [] + + diffSchemas targetSchema actualSchema `shouldBe` migration + it "should deal with truncated identifiers" do let actualSchema = sql $ cs [plain| CREATE POLICY "Users can manage the prepare_context_jobs if they can see the C" ON public.prepare_context_jobs USING ((EXISTS ( SELECT 1