(t *testing.T)
| 588 | } |
| 589 | |
| 590 | func TestPropagateUnscoped(t *testing.T) { |
| 591 | _DB, err := OpenTestConnection(&gorm.Config{ |
| 592 | PropagateUnscoped: true, |
| 593 | }) |
| 594 | if err != nil { |
| 595 | log.Printf("failed to connect database, got error %v", err) |
| 596 | os.Exit(1) |
| 597 | } |
| 598 | |
| 599 | _DB.Migrator().DropTable(&Product6{}, &ProductItem2{}) |
| 600 | _DB.AutoMigrate(&Product6{}, &ProductItem2{}) |
| 601 | |
| 602 | p := Product6{ |
| 603 | Name: "unique_code", |
| 604 | Item: &ProductItem2{}, |
| 605 | } |
| 606 | _DB.Model(&Product6{}).Create(&p) |
| 607 | |
| 608 | if err := _DB.Unscoped().Delete(&p).Error; err != nil { |
| 609 | t.Fatalf("unscoped did not propagate") |
| 610 | } |
| 611 | } |
nothing calls this directly
no test coverage detected