fix(pkg/db): create or upgrade postgres schema based on semver

This commit is contained in:
2019-09-01 12:27:06 +02:00
parent f19cc3249a
commit 6223f4e79b
21 changed files with 301 additions and 91 deletions

View File

@ -4,17 +4,22 @@ import (
"log"
"time"
"github.com/Masterminds/semver"
"github.com/go-flucky/flucky/pkg/config"
"github.com/go-flucky/flucky/pkg/daemon"
"github.com/go-flucky/flucky/pkg/logger"
"github.com/spf13/cobra"
)
var cleanCacheInterval string
var compression bool
var configFile *string
var round float64
var temperatureUnit string
var (
cleanCacheInterval string
compression bool
configFile *string
round float64
temperatureUnit string
version *semver.Version
)
var daemonCmd = &cobra.Command{
Use: "daemon",
@ -38,8 +43,10 @@ var daemonCmd = &cobra.Command{
},
}
func InitCmd(cmd *cobra.Command, cnfFile *string) {
func InitCmd(cmd *cobra.Command, cnfFile *string, sverion *semver.Version) {
configFile = cnfFile
version = sversion
cmd.AddCommand(daemonCmd)
daemonCmd.Flags().BoolVar(&compression, "compression", true, "Compress measured values")
daemonCmd.Flags().StringVar(&cleanCacheInterval, "clean-cache-interval", "5m", "Minute intervall to clean cache and write measured values into logfile")