Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for DropConstraint (0.16 sec)

  1. migrator.go

    	// Views
    	CreateView(name string, option ViewOption) error
    	DropView(name string) error
    
    	// Constraints
    	CreateConstraint(dst interface{}, name string) error
    	DropConstraint(dst interface{}, name string) error
    	HasConstraint(dst interface{}, name string) bool
    
    	// Indexes
    	CreateIndex(dst interface{}, name string) error
    	DropIndex(dst interface{}, name string) error
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 3.1K bytes
    - Viewed (0)
  2. 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 Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 28.5K bytes
    - Viewed (0)
  3. 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 Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K bytes
    - Viewed (0)
Back to top