Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PaymentServer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Administrator
PaymentServer
Commits
d8054f18
Unverified
Commit
d8054f18
authored
5 years ago
by
Jean-Paul Calderone
Browse files
Options
Downloads
Patches
Plain Diff
Initialize the schema in a transaction
It's probably not strictly necessary but it's sort of nice.
parent
967e34f1
Loading
Loading
1 merge request
!61
Fix intermittent "Database is locked" errors
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/PaymentServer/Persistence.hs
+4
-3
4 additions, 3 deletions
src/PaymentServer/Persistence.hs
with
4 additions
and
3 deletions
src/PaymentServer/Persistence.hs
+
4
−
3
View file @
d8054f18
...
@@ -337,6 +337,7 @@ sqlite path =
...
@@ -337,6 +337,7 @@ sqlite path =
dbConn
<-
Sqlite
.
open
(
unpack
path
)
dbConn
<-
Sqlite
.
open
(
unpack
path
)
let
exec
=
Sqlite
.
execute_
dbConn
let
exec
=
Sqlite
.
execute_
dbConn
exec
"PRAGMA foreign_keys = ON"
exec
"PRAGMA foreign_keys = ON"
Sqlite
.
withExclusiveTransaction
dbConn
$
do
exec
"CREATE TABLE IF NOT EXISTS vouchers (id INTEGER PRIMARY KEY, name TEXT UNIQUE)"
exec
"CREATE TABLE IF NOT EXISTS vouchers (id INTEGER PRIMARY KEY, name TEXT UNIQUE)"
exec
"CREATE TABLE IF NOT EXISTS redeemed (id INTEGER PRIMARY KEY, voucher_id INTEGER, counter INTEGER, fingerprint TEXT, FOREIGN KEY (voucher_id) REFERENCES vouchers(id))"
exec
"CREATE TABLE IF NOT EXISTS redeemed (id INTEGER PRIMARY KEY, voucher_id INTEGER, counter INTEGER, fingerprint TEXT, FOREIGN KEY (voucher_id) REFERENCES vouchers(id))"
return
dbConn
return
dbConn
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment