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
183ce534
Commit
183ce534
authored
May 27, 2022
by
boojack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: add `ON DELETE CASCADE`
parent
cc2e5ab6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
10001__schema.sql
store/db/migration/10001__schema.sql
+5
-5
No files found.
store/db/migration/10001__schema.sql
View file @
183ce534
...
@@ -37,7 +37,7 @@ CREATE TABLE memo (
...
@@ -37,7 +37,7 @@ CREATE TABLE memo (
updated_ts
BIGINT
NOT
NULL
DEFAULT
(
strftime
(
'%s'
,
'now'
)),
updated_ts
BIGINT
NOT
NULL
DEFAULT
(
strftime
(
'%s'
,
'now'
)),
row_status
TEXT
NOT
NULL
CHECK
(
row_status
IN
(
'NORMAL'
,
'ARCHIVED'
))
DEFAULT
'NORMAL'
,
row_status
TEXT
NOT
NULL
CHECK
(
row_status
IN
(
'NORMAL'
,
'ARCHIVED'
))
DEFAULT
'NORMAL'
,
content
TEXT
NOT
NULL
DEFAULT
''
,
content
TEXT
NOT
NULL
DEFAULT
''
,
FOREIGN
KEY
(
creator_id
)
REFERENCES
user
(
id
)
FOREIGN
KEY
(
creator_id
)
REFERENCES
user
(
id
)
ON
DELETE
CASCADE
);
);
INSERT
INTO
INSERT
INTO
...
@@ -63,8 +63,8 @@ CREATE TABLE memo_organizer (
...
@@ -63,8 +63,8 @@ CREATE TABLE memo_organizer (
memo_id
INTEGER
NOT
NULL
,
memo_id
INTEGER
NOT
NULL
,
user_id
INTEGER
NOT
NULL
,
user_id
INTEGER
NOT
NULL
,
pinned
INTEGER
NOT
NULL
CHECK
(
pinned
IN
(
0
,
1
))
DEFAULT
0
,
pinned
INTEGER
NOT
NULL
CHECK
(
pinned
IN
(
0
,
1
))
DEFAULT
0
,
FOREIGN
KEY
(
memo_id
)
REFERENCES
memo
(
id
),
FOREIGN
KEY
(
memo_id
)
REFERENCES
memo
(
id
)
ON
DELETE
CASCADE
,
FOREIGN
KEY
(
user_id
)
REFERENCES
user
(
id
),
FOREIGN
KEY
(
user_id
)
REFERENCES
user
(
id
)
ON
DELETE
CASCADE
,
UNIQUE
(
memo_id
,
user_id
)
UNIQUE
(
memo_id
,
user_id
)
);
);
...
@@ -82,7 +82,7 @@ CREATE TABLE shortcut (
...
@@ -82,7 +82,7 @@ CREATE TABLE shortcut (
row_status
TEXT
NOT
NULL
CHECK
(
row_status
IN
(
'NORMAL'
,
'ARCHIVED'
))
DEFAULT
'NORMAL'
,
row_status
TEXT
NOT
NULL
CHECK
(
row_status
IN
(
'NORMAL'
,
'ARCHIVED'
))
DEFAULT
'NORMAL'
,
title
TEXT
NOT
NULL
DEFAULT
''
,
title
TEXT
NOT
NULL
DEFAULT
''
,
payload
TEXT
NOT
NULL
DEFAULT
'{}'
,
payload
TEXT
NOT
NULL
DEFAULT
'{}'
,
FOREIGN
KEY
(
creator_id
)
REFERENCES
user
(
id
)
FOREIGN
KEY
(
creator_id
)
REFERENCES
user
(
id
)
ON
DELETE
CASCADE
);
);
INSERT
INTO
INSERT
INTO
...
@@ -112,7 +112,7 @@ CREATE TABLE resource (
...
@@ -112,7 +112,7 @@ CREATE TABLE resource (
blob
BLOB
NOT
NULL
,
blob
BLOB
NOT
NULL
,
type
TEXT
NOT
NULL
DEFAULT
''
,
type
TEXT
NOT
NULL
DEFAULT
''
,
size
INTEGER
NOT
NULL
DEFAULT
0
,
size
INTEGER
NOT
NULL
DEFAULT
0
,
FOREIGN
KEY
(
creator_id
)
REFERENCES
user
(
id
)
FOREIGN
KEY
(
creator_id
)
REFERENCES
user
(
id
)
ON
DELETE
CASCADE
);
);
INSERT
INTO
INSERT
INTO
...
...
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