Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
152
Issues
152
List
Board
Labels
Milestones
Merge Requests
9
Merge Requests
9
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
gargantext
haskell-gargantext
Commits
59ecd4af
Commit
59ecd4af
authored
Jul 21, 2022
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[nodeStory] sql upgrade scripts
parent
75b2ee63
Pipeline
#3044
failed with stage
in 56 minutes and 12 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
0.0.5.9.1.sql
devops/postgres/upgrade/0.0.5.9.1.sql
+23
-0
0.0.5.9.sql
devops/postgres/upgrade/0.0.5.9.sql
+10
-0
No files found.
devops/postgres/upgrade/0.0.5.9.1.sql
0 → 100644
View file @
59ecd4af
create
table
public
.
node_story_archive_history
(
id
SERIAL
,
node_id
INTEGER
NOT
NULL
,
ngrams_type_id
INTEGER
NOT
NULL
,
patch
jsonb
DEFAULT
'{}'
::
jsonb
NOT
NULL
,
PRIMARY
KEY
(
id
),
FOREIGN
KEY
(
node_id
)
REFERENCES
public
.
nodes
(
id
)
ON
DELETE
CASCADE
);
ALTER
TABLE
public
.
node_story_archive_history
OWNER
TO
gargantua
;
INSERT
INTO
node_story_archive_history
(
node_id
,
ngrams_type_id
,
patch
)
SELECT
t
.
node_id
,
t
.
ngrams_type_id
,
t
.
patch
FROM
(
WITH
q
AS
(
SELECT
node_id
,
history
.
*
,
row_number
()
over
(
ORDER
BY
node_id
)
AS
sid
FROM
node_stories
,
jsonb_to_recordset
(
archive
->
'history'
)
AS
history
(
"Authors"
jsonb
,
"Institutes"
jsonb
,
"NgramsTerms"
jsonb
,
"Sources"
jsonb
))
(
SELECT
node_id
,
sid
,
1
AS
ngrams_type_id
,
"Authors"
AS
patch
FROM
q
WHERE
"Authors"
IS
NOT
NULL
)
UNION
(
SELECT
node_id
,
sid
,
2
AS
ngrams_type_id
,
"Institutes"
AS
patch
FROM
q
WHERE
"Institutes"
IS
NOT
NULL
)
UNION
(
SELECT
node_id
,
sid
,
4
AS
ngrams_type_id
,
"NgramsTerms"
AS
patch
FROM
q
WHERE
"NgramsTerms"
IS
NOT
NULL
)
UNION
(
SELECT
node_id
,
sid
,
3
AS
ngrams_type_id
,
"Sources"
AS
patch
FROM
q
WHERE
"Sources"
IS
NOT
NULL
)
ORDER
BY
node_id
,
ngrams_type_id
,
sid
)
AS
t
;
devops/postgres/upgrade/0.0.5.9.sql
0 → 100644
View file @
59ecd4af
create
table
public
.
node_stories
(
id
SERIAL
,
node_id
INTEGER
NOT
NULL
,
archive
jsonb
DEFAULT
'{}'
::
jsonb
NOT
NULL
,
PRIMARY
KEY
(
id
),
FOREIGN
KEY
(
node_id
)
REFERENCES
public
.
nodes
(
id
)
ON
DELETE
CASCADE
);
ALTER
TABLE
public
.
node_stories
OWNER
TO
gargantua
;
CREATE
UNIQUE
INDEX
ON
public
.
node_stories
USING
btree
(
node_id
);
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