Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
4608894e
Commit
4608894e
authored
Sep 18, 2022
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: add `_foreign_keys` to sqlite dsn
parent
a1066322
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1 addition
and
5 deletions
+1
-5
db.go
store/db/db.go
+1
-1
memo.go
store/memo.go
+0
-1
resource.go
store/resource.go
+0
-1
shortcut.go
store/shortcut.go
+0
-1
user.go
store/user.go
+0
-1
No files found.
store/db/db.go
View file @
4608894e
...
...
@@ -43,7 +43,7 @@ func (db *DB) Open(ctx context.Context) (err error) {
}
// Connect to the database.
sqlDB
,
err
:=
sql
.
Open
(
"sqlite3"
,
db
.
profile
.
DSN
)
sqlDB
,
err
:=
sql
.
Open
(
"sqlite3"
,
db
.
profile
.
DSN
+
"?_foreign_keys=1"
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to open db with dsn: %s, err: %w"
,
db
.
profile
.
DSN
,
err
)
}
...
...
store/memo.go
View file @
4608894e
...
...
@@ -354,7 +354,6 @@ func findMemoRawList(ctx context.Context, tx *sql.Tx, find *api.MemoFind) ([]*me
func
deleteMemo
(
ctx
context
.
Context
,
tx
*
sql
.
Tx
,
delete
*
api
.
MemoDelete
)
error
{
result
,
err
:=
tx
.
ExecContext
(
ctx
,
`
PRAGMA foreign_keys = ON;
DELETE FROM memo WHERE id = ?
`
,
delete
.
ID
)
if
err
!=
nil
{
...
...
store/resource.go
View file @
4608894e
...
...
@@ -241,7 +241,6 @@ func findResourceList(ctx context.Context, tx *sql.Tx, find *api.ResourceFind) (
func
deleteResource
(
ctx
context
.
Context
,
tx
*
sql
.
Tx
,
delete
*
api
.
ResourceDelete
)
error
{
result
,
err
:=
tx
.
ExecContext
(
ctx
,
`
PRAGMA foreign_keys = ON;
DELETE FROM resource WHERE id = ? AND creator_id = ?
`
,
delete
.
ID
,
delete
.
CreatorID
)
if
err
!=
nil
{
...
...
store/shortcut.go
View file @
4608894e
...
...
@@ -288,7 +288,6 @@ func findShortcutList(ctx context.Context, tx *sql.Tx, find *api.ShortcutFind) (
func
deleteShortcut
(
ctx
context
.
Context
,
tx
*
sql
.
Tx
,
delete
*
api
.
ShortcutDelete
)
error
{
result
,
err
:=
tx
.
ExecContext
(
ctx
,
`
PRAGMA foreign_keys = ON;
DELETE FROM shortcut WHERE id = ?
`
,
delete
.
ID
)
if
err
!=
nil
{
...
...
store/user.go
View file @
4608894e
...
...
@@ -351,7 +351,6 @@ func findUserList(ctx context.Context, tx *sql.Tx, find *api.UserFind) ([]*userR
func
deleteUser
(
ctx
context
.
Context
,
tx
*
sql
.
Tx
,
delete
*
api
.
UserDelete
)
error
{
result
,
err
:=
tx
.
ExecContext
(
ctx
,
`
PRAGMA foreign_keys = ON;
DELETE FROM user WHERE id = ?
`
,
delete
.
ID
)
if
err
!=
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment