Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for DropConstraint (0.15 sec)

  1. 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 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  2. 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)
    		}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K bytes
    - Viewed (0)
Back to top