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
145
Issues
145
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
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
e724b810
Commit
e724b810
authored
Jan 18, 2022
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[MIGRATION] New schema migration SQL script
parent
57cc77e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
0 deletions
+77
-0
schema.sql
devops/postgres/upgrade/0.0.5/schema.sql
+77
-0
No files found.
devops/postgres/upgrade/0.0.5/schema.sql
0 → 100644
View file @
e724b810
-- TODO typename -> type_id
CREATE
TABLE
public
.
contexts
(
id
SERIAL
,
hash_id
CHARACTER
varying
(
66
)
DEFAULT
''
::
character
varying
NOT
NULL
,
typename
INTEGER
NOT
NULL
,
user_id
INTEGER
NOT
NULL
,
parent_id
INTEGER
REFERENCES
public
.
contexts
(
id
)
ON
DELETE
CASCADE
,
name
CHARACTER
varying
(
255
)
DEFAULT
''
::
character
varying
NOT
NULL
,
date
TIMESTAMP
with
time
zone
DEFAULT
now
()
NOT
NULL
,
hyperdata
jsonb
DEFAULT
'{}'
::
jsonb
NOT
NULL
,
search
tsvector
,
PRIMARY
KEY
(
id
),
FOREIGN
KEY
(
user_id
)
REFERENCES
public
.
auth_user
(
id
)
ON
DELETE
CASCADE
);
ALTER
TABLE
public
.
contexts
OWNER
TO
gargantua
;
-- To attach contexts to a Corpus
CREATE
TABLE
public
.
nodes_contexts
(
node_id
INTEGER
NOT
NULL
REFERENCES
public
.
nodes
(
id
)
ON
DELETE
CASCADE
,
context_id
INTEGER
NOT
NULL
REFERENCES
public
.
contexts
(
id
)
ON
DELETE
CASCADE
,
score
REAL
,
category
INTEGER
,
PRIMARY
KEY
(
node_id
,
context_id
)
);
ALTER
TABLE
public
.
nodes_contexts
OWNER
TO
gargantua
;
---------------------------------------------------------------
CREATE
TABLE
public
.
context_node_ngrams
(
context_id
INTEGER
NOT
NULL
REFERENCES
public
.
contexts
(
id
)
ON
DELETE
CASCADE
,
node_id
INTEGER
NOT
NULL
REFERENCES
public
.
nodes
(
id
)
ON
DELETE
CASCADE
,
ngrams_id
INTEGER
NOT
NULL
REFERENCES
public
.
ngrams
(
id
)
ON
DELETE
CASCADE
,
ngrams_type
INTEGER
,
weight
double
precision
,
PRIMARY
KEY
(
context_id
,
node_id
,
ngrams_id
,
ngrams_type
)
);
ALTER
TABLE
public
.
context_node_ngrams
OWNER
TO
gargantua
;
CREATE
TABLE
public
.
context_node_ngrams2
(
context_id
INTEGER
NOT
NULL
REFERENCES
public
.
contexts
(
id
)
ON
DELETE
CASCADE
,
nodengrams_id
INTEGER
NOT
NULL
REFERENCES
public
.
node_ngrams
(
id
)
ON
DELETE
CASCADE
,
weight
double
precision
,
PRIMARY
KEY
(
context_id
,
nodengrams_id
)
);
ALTER
TABLE
public
.
context_node_ngrams2
OWNER
TO
gargantua
;
CREATE
INDEX
ON
public
.
contexts
USING
gin
(
hyperdata
);
CREATE
INDEX
ON
public
.
contexts
USING
btree
(
user_id
,
typename
,
parent_id
);
CREATE
INDEX
ON
public
.
contexts
USING
btree
(
id
,
typename
,
date
ASC
);
CREATE
INDEX
ON
public
.
contexts
USING
btree
(
id
,
typename
,
date
DESC
);
CREATE
INDEX
ON
public
.
contexts
USING
btree
(
typename
,
id
);
CREATE
UNIQUE
INDEX
ON
public
.
contexts
USING
btree
(
hash_id
);
-- To make the links between Corpus Node and its contexts
CREATE
UNIQUE
INDEX
ON
public
.
nodes_contexts
USING
btree
(
node_id
,
context_id
);
CREATE
INDEX
ON
public
.
nodes_contexts
USING
btree
(
node_id
,
context_id
,
category
);
------------------------------------------------------------------------
CREATE
UNIQUE
INDEX
ON
public
.
context_node_ngrams
USING
btree
(
context_id
,
node_id
,
ngrams_id
,
ngrams_type
);
CREATE
INDEX
ON
public
.
context_node_ngrams
USING
btree
(
context_id
,
node_id
);
CREATE
INDEX
ON
public
.
context_node_ngrams
USING
btree
(
ngrams_id
,
node_id
);
CREATE
INDEX
ON
public
.
context_node_ngrams
USING
btree
(
ngrams_type
);
CREATE
INDEX
ON
public
.
context_node_ngrams2
USING
btree
(
context_id
);
CREATE
INDEX
ON
public
.
context_node_ngrams2
USING
btree
(
nodengrams_id
);
CREATE
INDEX
ON
public
.
context_node_ngrams2
USING
btree
(
context_id
,
nodengrams_id
);
DELETE
TABLE
public
.
node_nodengrams_nodengrams
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