Exemple #1
0
func apply(stamp, current int, count *int, hd *hood.Hood, info *Migrations, structVal reflect.Value, method reflect.Method) {
	log.Printf("applying %s...", method.Name)
	txn := hd.Begin()
	method.Func.Call([]reflect.Value{structVal, reflect.ValueOf(txn)})
	info.Current = current
	txn.Save(info)
	err := txn.Commit()
	if err != nil {
		panic(err)
	} else {
		*count++
	}

}
Exemple #2
0
/* Create all of the tables in the master schema */
func CreateTables(hd *hood.Hood) {
	tx := hd.Begin()

	// List all table names here
	tables := []interface{}{
		&Rdd{}, &Segment{}, &RddEdge{}, &Workflow{}, &WorkflowEdge{},
		&Protojob{}, &WorkflowBatch{}, &Worker{}, &SegmentCopy{},
	}

	for _, table := range tables {
		err := tx.CreateTable(table)
		if err != nil {
			panic(err)
		}
	}

	err := tx.Commit()
	if err != nil {
		panic(err)
	}
}