From d32d98840bc23e74c836f8192cb4bc9529aa9233 Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Tue, 22 Feb 2022 12:06:08 +0200 Subject: [PATCH] fix(dbfixture): apply cascade option. Fixes #447 --- dbfixture/fixture.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dbfixture/fixture.go b/dbfixture/fixture.go index 56b42440e..c6eafa675 100644 --- a/dbfixture/fixture.go +++ b/dbfixture/fixture.go @@ -281,6 +281,7 @@ func (f *Fixture) dropTable(ctx context.Context, table *schema.Table) error { if _, err := f.db.NewDropTable(). Model(table.ZeroIface). IfExists(). + Cascade(). Exec(ctx); err != nil { return err } @@ -302,6 +303,7 @@ func (f *Fixture) truncateTable(ctx context.Context, table *schema.Table) error if _, err := f.db.NewTruncateTable(). Model(table.ZeroIface). + Cascade(). Exec(ctx); err != nil { return err }