Add migrations and continue implementing election insertion
This commit is contained in:
@ -3,10 +3,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
db2 "code.dlmw.ch/dlmw/qv/internal/db"
|
||||
"code.dlmw.ch/dlmw/qv/internal/models"
|
||||
"database/sql"
|
||||
"github.com/go-playground/form/v4"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
stdlib "github.com/multiprocessio/go-sqlite3-stdlib"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"os"
|
||||
@ -22,6 +24,7 @@ type application struct {
|
||||
var addr = ":8080"
|
||||
|
||||
func main() {
|
||||
stdlib.Register("sqlite_math_functions")
|
||||
logger := slog.New(slog.NewJSONHandler(os.Stdout, nil))
|
||||
|
||||
db, err := openDb()
|
||||
@ -30,6 +33,11 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
defer db.Close()
|
||||
err = db2.RunMigrations(db)
|
||||
if err != nil {
|
||||
logger.Error(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
formDecoder := form.NewDecoder()
|
||||
|
||||
|
Reference in New Issue
Block a user