- Sort Score
- Num 10 results
- Language All
Results 1 - 2 of 2 for DropConstraint (0.1 seconds)
-
migrator/migrator.go
} sql, values := constraint.Build() return m.DB.Exec("ALTER TABLE ? ADD "+sql, append(vars, values...)...).Error } return nil }) } // DropConstraint drop constraint func (m Migrator) DropConstraint(value interface{}, name string) error { return m.RunWithValue(value, func(stmt *gorm.Statement) error { constraint, table := m.GuessConstraintInterfaceAndTable(stmt, name) if constraint != nil {
Created: Sun Apr 05 09:35:12 GMT 2026 - Last Modified: Sat Mar 21 11:49:01 GMT 2026 - 29.8K bytes - Click Count (0) -
tests/migrate_test.go
for _, name := range names { if !DB.Migrator().HasConstraint(&User{}, name) { DB.Migrator().CreateConstraint(&User{}, name) } if err := DB.Migrator().DropConstraint(&User{}, name); err != nil { t.Fatalf("failed to drop constraint %v, got error %v", name, err) } if DB.Migrator().HasConstraint(&User{}, name) { t.Fatalf("constraint %v should been deleted", name) }Created: Sun Apr 05 09:35:12 GMT 2026 - Last Modified: Sat Mar 21 11:49:01 GMT 2026 - 66.3K bytes - Click Count (0)