mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
fix: add migration for newly introduced has data field
This commit is contained in:
parent
30510591eb
commit
e2f046a83d
20
migrations/20210213_add_has_data_field.go
Normal file
20
migrations/20210213_add_has_data_field.go
Normal file
@ -0,0 +1,20 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/muety/wakapi/config"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func init() {
|
||||
f := migrationFunc{
|
||||
name: "20210213_add_has_data_field",
|
||||
f: func(db *gorm.DB, cfg *config.Config) error {
|
||||
if err := db.Exec("UPDATE users SET has_data = TRUE WHERE 1").Error; err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
registerPostMigration(f)
|
||||
}
|
@ -50,16 +50,9 @@ String.prototype.toHHMMSS = function () {
|
||||
}
|
||||
|
||||
String.prototype.toHHMM = function () {
|
||||
var sec_num = parseInt(this, 10)
|
||||
var hours = Math.floor(sec_num / 3600)
|
||||
var minutes = Math.floor((sec_num - (hours * 3600)) / 60)
|
||||
|
||||
if (hours < 10 && hours > 0) {
|
||||
hours = '0' + hours
|
||||
}
|
||||
if (minutes < 10 && minutes > 0) {
|
||||
minutes = '0' + minutes
|
||||
}
|
||||
const sec_num = parseInt(this, 10)
|
||||
const hours = Math.floor(sec_num / 3600)
|
||||
const minutes = Math.floor((sec_num - (hours * 3600)) / 60)
|
||||
return hours + ':' + minutes
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user