feat(migrator.go and migrator/migrator.go) : remove Table Struct replace with []string
This commit is contained in:
		
							parent
							
								
									f676d504f3
								
							
						
					
					
						commit
						acde65b965
					
				@ -36,11 +36,6 @@ type ViewOption struct {
 | 
			
		||||
// ALLTables get all database tables
 | 
			
		||||
const ALLTables = "migrator:all_tables"
 | 
			
		||||
 | 
			
		||||
// Table Database table list info
 | 
			
		||||
type Table struct {
 | 
			
		||||
	TableName string `gorm:"column:TABLE_NAME"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type ColumnType interface {
 | 
			
		||||
	Name() string
 | 
			
		||||
	DatabaseTypeName() string
 | 
			
		||||
@ -62,7 +57,8 @@ type Migrator interface {
 | 
			
		||||
	DropTable(dst ...interface{}) error
 | 
			
		||||
	HasTable(dst interface{}) bool
 | 
			
		||||
	RenameTable(oldName, newName interface{}) error
 | 
			
		||||
	GetTables(tables ...string) (tableList []Table, err error)
 | 
			
		||||
	GetTables(tables ...string) (tableList []string, err error)
 | 
			
		||||
 | 
			
		||||
	// Columns
 | 
			
		||||
	AddColumn(dst interface{}, field string) error
 | 
			
		||||
	DropColumn(dst interface{}, field string) error
 | 
			
		||||
 | 
			
		||||
@ -162,7 +162,7 @@ func (m Migrator) AutoMigrate(values ...interface{}) error {
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m Migrator) GetTables(tables ...string) (tableList []gorm.Table, err error) {
 | 
			
		||||
func (m Migrator) GetTables(tables ...string) (tableList []string, err error) {
 | 
			
		||||
	if len(tables) == 1 && tables[0] == gorm.ALLTables {
 | 
			
		||||
		return tableList, m.DB.Raw(allTableQuery, m.CurrentDatabase()).Scan(&tableList).Error
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user