Fixed database extension
This commit is contained in:
parent
c0f1ed6879
commit
eb94ce4552
|
@ -2,3 +2,4 @@ snapshots.dat
|
||||||
.env
|
.env
|
||||||
dist
|
dist
|
||||||
data.db
|
data.db
|
||||||
|
data.sqlite
|
|
@ -24,7 +24,7 @@ func GetConfiguration() DHConfig {
|
||||||
config := DHConfig{
|
config := DHConfig{
|
||||||
DiskFetchFrequency: 5, // default value
|
DiskFetchFrequency: 5, // default value
|
||||||
MaxHistoryAge: 2592000, // default value
|
MaxHistoryAge: 2592000, // default value
|
||||||
DatabaseFilePath: "./data.db",
|
DatabaseFilePath: "./data.sqlite",
|
||||||
|
|
||||||
Listen: ":8080",
|
Listen: ":8080",
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ func GetSystemHardDrives(db *gorm.DB, olderThan *time.Time, newerThan *time.Time
|
||||||
|
|
||||||
for _, sysHDD := range systemHardDrives {
|
for _, sysHDD := range systemHardDrives {
|
||||||
var existingHD HardDrive
|
var existingHD HardDrive
|
||||||
q := db.Where("serial = ?", sysHDD.Serial)
|
q := db.Where("serial = ? AND model = ? AND type = ?", sysHDD.Serial, sysHDD.Model, sysHDD.Type)
|
||||||
|
|
||||||
if newerThan != nil && olderThan != nil {
|
if newerThan != nil && olderThan != nil {
|
||||||
fmt.Printf("\nNewer Than: %s\n", newerThan)
|
fmt.Printf("\nNewer Than: %s\n", newerThan)
|
||||||
|
|
|
@ -16,7 +16,7 @@ func InitDB() {
|
||||||
var err error
|
var err error
|
||||||
dbPath := config.GetConfiguration().DatabaseFilePath
|
dbPath := config.GetConfiguration().DatabaseFilePath
|
||||||
if dbPath == "" {
|
if dbPath == "" {
|
||||||
dbPath = "./data.db"
|
dbPath = "./data.sqlite"
|
||||||
}
|
}
|
||||||
|
|
||||||
db, err = gorm.Open(sqlite.Open(dbPath), &gorm.Config{})
|
db, err = gorm.Open(sqlite.Open(dbPath), &gorm.Config{})
|
||||||
|
|
Loading…
Reference in New Issue