Search Options

Results per page
Sort
Preferred Languages
Advance

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

  1. migrator.go

    	FullDataTypeOf(*schema.Field) clause.Expr
    	GetTypeAliases(databaseTypeName string) []string
    
    	// Tables
    	CreateTable(dst ...interface{}) error
    	DropTable(dst ...interface{}) error
    	HasTable(dst interface{}) bool
    	RenameTable(oldName, newName interface{}) error
    	GetTables() (tableList []string, err error)
    	TableType(dst interface{}) (TableType, error)
    
    	// Columns
    	AddColumn(dst interface{}, field 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

    	})
    
    	return count > 0
    }
    
    // RenameTable rename table from oldName to newName
    func (m Migrator) RenameTable(oldName, newName interface{}) error {
    	var oldTable, newTable interface{}
    	if v, ok := oldName.(string); ok {
    		oldTable = clause.Table{Name: v}
    	} else {
    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

    	if !DB.Migrator().HasTable(&TableStruct{}) {
    		t.Fatalf("should found created table")
    	}
    
    	type NewTableStruct struct {
    		gorm.Model
    		Name string
    	}
    
    	if err := DB.Migrator().RenameTable(&TableStruct{}, &NewTableStruct{}); err != nil {
    		t.Fatalf("Failed to rename table, got error %v", err)
    	}
    
    	if !DB.Migrator().HasTable("new_table_structs") {
    		t.Fatal("should found renamed table")
    	}
    
    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