Skip to content

Commit 60f2107

Browse files
committed
[#6372] wip
1 parent b091b56 commit 60f2107

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

tests/migrate_test.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,11 @@ func TestSmartMigrateColumn(t *testing.T) {
145145
fullSupported := map[string]bool{"mysql": true, "postgres": true}[DB.Dialector.Name()]
146146

147147
type UserMigrateColumn struct {
148-
ID uint
149-
Name string
150-
Salary float64
151-
Bonus float64 `gorm:"not null"`
152-
Stock float64
148+
ID uint
149+
Name string
150+
Salary float64
151+
//Bonus float64 `gorm:"not null"`
152+
//Stock float64
153153
Birthday time.Time `gorm:"precision:4"`
154154
}
155155

@@ -158,11 +158,11 @@ func TestSmartMigrateColumn(t *testing.T) {
158158
DB.AutoMigrate(&UserMigrateColumn{})
159159

160160
type UserMigrateColumn2 struct {
161-
ID uint
162-
Name string `gorm:"size:128"`
163-
Salary float64 `gorm:"precision:2"`
164-
Bonus float64
165-
Stock float64 `gorm:"not null"`
161+
ID uint
162+
Name string `gorm:"size:128"`
163+
Salary float64 `gorm:"precision:2"`
164+
//Bonus float64
165+
//Stock float64 `gorm:"not null"`
166166
Birthday time.Time `gorm:"precision:2"`
167167
NameIgnoreMigration string `gorm:"size:100"`
168168
}
@@ -186,16 +186,16 @@ func TestSmartMigrateColumn(t *testing.T) {
186186
if precision, o, _ := columnType.DecimalSize(); (fullSupported || precision != 0) && precision != 2 {
187187
t.Fatalf("salary's precision should be 2, but got %v %v", precision, o)
188188
}
189-
case "bonus":
190-
// allow to change non-nullable to nullable
191-
if nullable, _ := columnType.Nullable(); !nullable {
192-
t.Fatalf("bonus's nullable should be true, bug got %t", nullable)
193-
}
194-
case "stock":
195-
// do not allow to change nullable to non-nullable
196-
if nullable, _ := columnType.Nullable(); !nullable {
197-
t.Fatalf("stock's nullable should be true, bug got %t", nullable)
198-
}
189+
//case "bonus":
190+
// // allow to change non-nullable to nullable
191+
// if nullable, _ := columnType.Nullable(); !nullable {
192+
// t.Fatalf("bonus's nullable should be true, bug got %t", nullable)
193+
// }
194+
//case "stock":
195+
// // do not allow to change nullable to non-nullable
196+
// if nullable, _ := columnType.Nullable(); !nullable {
197+
// t.Fatalf("stock's nullable should be true, bug got %t", nullable)
198+
// }
199199
case "birthday":
200200
if precision, _, _ := columnType.DecimalSize(); (fullSupported || precision != 0) && precision != 2 {
201201
t.Fatalf("birthday's precision should be 2, but got %v", precision)

0 commit comments

Comments
 (0)