summaryrefslogtreecommitdiff
path: root/model/database.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2024-03-10 10:59:23 +0100
committerxengineering <me@xengineering.eu>2024-03-24 10:10:54 +0100
commitddc6e8e1fb8a4b1dfe8421b12e40b15162ae75f1 (patch)
tree202012df833fad11ee274b90bf1b9e3c76759339 /model/database.go
parent0520cf604c4dc3279d76e1dd4b49c275dd54611e (diff)
downloadceres-ddc6e8e1fb8a4b1dfe8421b12e40b15162ae75f1.tar
ceres-ddc6e8e1fb8a4b1dfe8421b12e40b15162ae75f1.tar.zst
ceres-ddc6e8e1fb8a4b1dfe8421b12e40b15162ae75f1.zip
model: Add recipe steps
This provides the infrastructure to create views and HTTP handlers to provide recipe steps.
Diffstat (limited to 'model/database.go')
-rw-r--r--model/database.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/model/database.go b/model/database.go
index 22a924a..7021181 100644
--- a/model/database.go
+++ b/model/database.go
@@ -38,6 +38,7 @@ func InitDatabase() {
log.Fatal(err)
}
+ // FIXME roll back migration on error
query, err := GetSql(`migrate`)
if err != nil {
log.Fatal(err)
@@ -67,3 +68,10 @@ func CloseDatabase() {
log.Println("Closed database")
}
}
+
+func rollback(tx *sql.Tx) {
+ err := tx.Rollback()
+ if err != nil {
+ log.Printf("Failed to rollback transaction: %v\n", err)
+ }
+}