remove trailing semicolon (not valid) and handlle float64 for Num

This commit is contained in:
Jim Lambert 2020-02-13 21:41:53 -05:00
parent a121ecdb15
commit a3c6b8a90e

View File

@ -181,6 +181,8 @@ func (i *Num) Scan(src interface{}) error {
*i = Num(n) *i = Num(n)
case int64: case int64:
*i = Num(s) *i = Num(s)
case float64:
*i = Num(s)
default: default:
return errors.New("Cannot scan NamedInt from " + reflect.ValueOf(src).String()) return errors.New("Cannot scan NamedInt from " + reflect.ValueOf(src).String())
} }
@ -289,7 +291,7 @@ func runMigration() {
} }
for _, table := range []string{"animals", "user_languages"} { for _, table := range []string{"animals", "user_languages"} {
DB.Exec(fmt.Sprintf("drop table %v;", table)) DB.Exec(fmt.Sprintf("drop table %v", table)) // ending with ";" is not valid in oracle
} }
values := []interface{}{&Short{}, &ReallyLongThingThatReferencesShort{}, &ReallyLongTableNameToTestMySQLNameLengthLimit{}, &NotSoLongTableName{}, &Product{}, &Email{}, &Address{}, &CreditCard{}, &Company{}, &Role{}, &Language{}, &HNPost{}, &EngadgetPost{}, &Animal{}, &User{}, &JoinTable{}, &Post{}, &Category{}, &Comment{}, &Cat{}, &Dog{}, &Hamster{}, &Toy{}, &ElementWithIgnoredField{}, &Place{}} values := []interface{}{&Short{}, &ReallyLongThingThatReferencesShort{}, &ReallyLongTableNameToTestMySQLNameLengthLimit{}, &NotSoLongTableName{}, &Product{}, &Email{}, &Address{}, &CreditCard{}, &Company{}, &Role{}, &Language{}, &HNPost{}, &EngadgetPost{}, &Animal{}, &User{}, &JoinTable{}, &Post{}, &Category{}, &Comment{}, &Cat{}, &Dog{}, &Hamster{}, &Toy{}, &ElementWithIgnoredField{}, &Place{}}