Update all unit test for AUTO_INCREMENT change
This commit is contained in:
		
							parent
							
								
									92821210e9
								
							
						
					
					
						commit
						2061731e2e
					
				@ -8,7 +8,7 @@ import (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type CustomizeColumn struct {
 | 
					type CustomizeColumn struct {
 | 
				
			||||||
	ID   int64     `gorm:"column:mapped_id; primary_key:yes"`
 | 
						ID   int64     `gorm:"column:mapped_id; primary_key:yes; AUTO_INCREMENT"`
 | 
				
			||||||
	Name string    `gorm:"column:mapped_name"`
 | 
						Name string    `gorm:"column:mapped_name"`
 | 
				
			||||||
	Date time.Time `gorm:"column:mapped_time"`
 | 
						Date time.Time `gorm:"column:mapped_time"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -67,12 +67,12 @@ func TestCustomColumnAndIgnoredFieldClash(t *testing.T) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type CustomizePerson struct {
 | 
					type CustomizePerson struct {
 | 
				
			||||||
	IdPerson string             `gorm:"column:idPerson;primary_key:true"`
 | 
						IdPerson string             `gorm:"column:idPerson;primary_key:true;AUTO_INCREMENT"`
 | 
				
			||||||
	Accounts []CustomizeAccount `gorm:"many2many:PersonAccount;associationforeignkey:idAccount;foreignkey:idPerson"`
 | 
						Accounts []CustomizeAccount `gorm:"many2many:PersonAccount;associationforeignkey:idAccount;foreignkey:idPerson"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type CustomizeAccount struct {
 | 
					type CustomizeAccount struct {
 | 
				
			||||||
	IdAccount string `gorm:"column:idAccount;primary_key:true"`
 | 
						IdAccount string `gorm:"column:idAccount;primary_key:true;AUTO_INCREMENT"`
 | 
				
			||||||
	Name      string
 | 
						Name      string
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -68,7 +68,7 @@ func OpenTestConnection() (db *gorm.DB, err error) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func TestStringPrimaryKey(t *testing.T) {
 | 
					func TestStringPrimaryKey(t *testing.T) {
 | 
				
			||||||
	type UUIDStruct struct {
 | 
						type UUIDStruct struct {
 | 
				
			||||||
		ID   string `gorm:"primary_key"`
 | 
							ID   string `gorm:"primary_key;AUTO_INCREMENT"`
 | 
				
			||||||
		Name string
 | 
							Name string
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	DB.AutoMigrate(&UUIDStruct{})
 | 
						DB.AutoMigrate(&UUIDStruct{})
 | 
				
			||||||
 | 
				
			|||||||
@ -130,7 +130,7 @@ func (i *Num) Scan(src interface{}) error {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type Animal struct {
 | 
					type Animal struct {
 | 
				
			||||||
	Counter    uint64    `gorm:"primary_key:yes"`
 | 
						Counter    uint64    `gorm:"primary_key:yes;AUTO_INCREMENT"`
 | 
				
			||||||
	Name       string    `sql:"DEFAULT:'galeone'"`
 | 
						Name       string    `sql:"DEFAULT:'galeone'"`
 | 
				
			||||||
	From       string    //test reserved sql keyword as field name
 | 
						From       string    //test reserved sql keyword as field name
 | 
				
			||||||
	Age        time.Time `sql:"DEFAULT:current_timestamp"`
 | 
						Age        time.Time `sql:"DEFAULT:current_timestamp"`
 | 
				
			||||||
 | 
				
			|||||||
@ -8,7 +8,7 @@ import (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type Blog struct {
 | 
					type Blog struct {
 | 
				
			||||||
	ID         uint   `gorm:"primary_key"`
 | 
						ID         uint   `gorm:"primary_key;AUTO_INCREMENT"`
 | 
				
			||||||
	Locale     string `gorm:"primary_key"`
 | 
						Locale     string `gorm:"primary_key"`
 | 
				
			||||||
	Subject    string
 | 
						Subject    string
 | 
				
			||||||
	Body       string
 | 
						Body       string
 | 
				
			||||||
@ -18,7 +18,7 @@ type Blog struct {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type Tag struct {
 | 
					type Tag struct {
 | 
				
			||||||
	ID     uint   `gorm:"primary_key"`
 | 
						ID     uint   `gorm:"primary_key;AUTO_INCREMENT"`
 | 
				
			||||||
	Locale string `gorm:"primary_key"`
 | 
						Locale string `gorm:"primary_key"`
 | 
				
			||||||
	Value  string
 | 
						Value  string
 | 
				
			||||||
	Blogs  []*Blog `gorm:"many2many:blogs_tags"`
 | 
						Blogs  []*Blog `gorm:"many2many:blogs_tags"`
 | 
				
			||||||
 | 
				
			|||||||
@ -734,12 +734,12 @@ func TestManyToManyPreloadWithMultiPrimaryKeys(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	type (
 | 
						type (
 | 
				
			||||||
		Level1 struct {
 | 
							Level1 struct {
 | 
				
			||||||
			ID           uint   `gorm:"primary_key;"`
 | 
								ID           uint   `gorm:"primary_key;AUTO_INCREMENT"`
 | 
				
			||||||
			LanguageCode string `gorm:"primary_key"`
 | 
								LanguageCode string `gorm:"primary_key"`
 | 
				
			||||||
			Value        string
 | 
								Value        string
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		Level2 struct {
 | 
							Level2 struct {
 | 
				
			||||||
			ID           uint   `gorm:"primary_key;"`
 | 
								ID           uint   `gorm:"primary_key;AUTO_INCREMENT"`
 | 
				
			||||||
			LanguageCode string `gorm:"primary_key"`
 | 
								LanguageCode string `gorm:"primary_key"`
 | 
				
			||||||
			Value        string
 | 
								Value        string
 | 
				
			||||||
			Level1s      []Level1 `gorm:"many2many:levels;"`
 | 
								Level1s      []Level1 `gorm:"many2many:levels;"`
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user