mirror of
https://github.com/Fluffy-Bean/TastyBites.git
synced 2025-05-20 18:34:53 +00:00
Add migration, status and pending checks to database
This commit is contained in:
parent
b2933a41c1
commit
66fb03fa0d
9 changed files with 146 additions and 42 deletions
|
@ -2,7 +2,8 @@ package database
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
"log"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/mattn/go-sqlite3"
|
||||
)
|
||||
|
@ -16,19 +17,22 @@ func Open() {
|
|||
|
||||
Conn, err = sql.Open("sqlite3", "tastybites.db?_journal_mode=WAL")
|
||||
if err != nil {
|
||||
log.Fatal("Error opening connection: ", err)
|
||||
fmt.Println("Error opening connection:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
//Set the connection to use WAL mode
|
||||
_, err = Conn.Exec("PRAGMA journal_mode=WAL;")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func Close() {
|
||||
err := Conn.Close()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue