mirror of
https://github.com/JustKato/drive-health.git
synced 2026-03-16 21:49:45 +02:00
Fixed database extension
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -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{})
|
||||||
|
|||||||
Reference in New Issue
Block a user