diff --git a/.gitignore b/.gitignore index ca03adb..36747db 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ snapshots.dat .env dist data.db +data.sqlite \ No newline at end of file diff --git a/lib/config/config.go b/lib/config/config.go index 5b0b754..f8a3fe1 100644 --- a/lib/config/config.go +++ b/lib/config/config.go @@ -24,7 +24,7 @@ func GetConfiguration() DHConfig { config := DHConfig{ DiskFetchFrequency: 5, // default value MaxHistoryAge: 2592000, // default value - DatabaseFilePath: "./data.db", + DatabaseFilePath: "./data.sqlite", Listen: ":8080", } diff --git a/lib/hardware/logic.go b/lib/hardware/logic.go index 793699c..8f89be4 100644 --- a/lib/hardware/logic.go +++ b/lib/hardware/logic.go @@ -64,7 +64,7 @@ func GetSystemHardDrives(db *gorm.DB, olderThan *time.Time, newerThan *time.Time for _, sysHDD := range systemHardDrives { 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 { fmt.Printf("\nNewer Than: %s\n", newerThan) diff --git a/lib/svc/service.go b/lib/svc/service.go index e011de1..8cf0e54 100644 --- a/lib/svc/service.go +++ b/lib/svc/service.go @@ -16,7 +16,7 @@ func InitDB() { var err error dbPath := config.GetConfiguration().DatabaseFilePath if dbPath == "" { - dbPath = "./data.db" + dbPath = "./data.sqlite" } db, err = gorm.Open(sqlite.Open(dbPath), &gorm.Config{})