Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for unique_name (0.19 sec)

  1. tests/table_test.go

    		for key := range constraints {
    			if len(key) != 63 {
    				t.Errorf("failed to find unique constraint, got %v", constraints)
    			}
    		}
    	})
    
    	t.Run("namer", func(t *testing.T) {
    		uname := "custom_unique_name"
    		db, _ := gorm.Open(postgres.Open(postgresDSN), &gorm.Config{
    			NamingStrategy: mockUniqueNamingStrategy{
    				UName: uname,
    			},
    		})
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sat Mar 09 09:31:28 GMT 2024
    - 10.6K bytes
    - Viewed (0)
  2. migrator/migrator.go

    	return m.RunWithValue(value, func(stmt *gorm.Statement) error {
    		// We're currently only receiving boolean values on `Unique` tag,
    		// so the UniqueConstraint name is fixed
    		constraint := m.DB.NamingStrategy.UniqueName(stmt.Table, field.DBName)
    		if unique && !field.Unique {
    			return m.DB.Migrator().DropConstraint(value, constraint)
    		}
    		if !unique && field.Unique {
    			return m.DB.Migrator().CreateConstraint(value, constraint)
    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)
Back to top