| 158 | } |
| 159 | |
| 160 | func TestGaussDBMany2ManyWithDefaultValueUUID(t *testing.T) { |
| 161 | t.Skipf("This test case skipped, because of gaussdb does not have 'uuid-ossp' extension") |
| 162 | if DB.Dialector.Name() != "gaussdb" { |
| 163 | t.Skip() |
| 164 | } |
| 165 | |
| 166 | if err := DB.Exec(`create extension if not exists "uuid-ossp"`).Error; err != nil { |
| 167 | t.Fatalf("Failed to create 'uuid-ossp' extension, but got error %v", err) |
| 168 | } |
| 169 | |
| 170 | DB.Migrator().DropTable(&Post{}, &Category{}, "post_categories") |
| 171 | DB.AutoMigrate(&Post{}, &Category{}) |
| 172 | |
| 173 | post := Post{ |
| 174 | Title: "Hello World", |
| 175 | Categories: []*Category{ |
| 176 | {Title: "Coding"}, |
| 177 | {Title: "Golang"}, |
| 178 | }, |
| 179 | } |
| 180 | |
| 181 | if err := DB.Create(&post).Error; err != nil { |
| 182 | t.Errorf("Failed, got error: %v", err) |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | func TestGaussDBOnConstraint(t *testing.T) { |
| 187 | t.Skipf("This test case skipped, because of gaussdb not support 'ON CONSTRAINT' statement") |