Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchCourrier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchCourrier
Commits
6e32fcbf
Commit
6e32fcbf
authored
5 years ago
by
Guillaume Heurtier
Browse files
Options
Downloads
Patches
Plain Diff
FEAT #12471 TIME 0:30 added sql for thesaurus in tags
parent
74cf8ad4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
migration/20.03/2003.sql
+24
-0
24 additions, 0 deletions
migration/20.03/2003.sql
sql/structure.sql
+14
-0
14 additions, 0 deletions
sql/structure.sql
with
38 additions
and
0 deletions
migration/20.03/2003.sql
+
24
−
0
View file @
6e32fcbf
...
...
@@ -236,12 +236,36 @@ DO $$ BEGIN
ALTER
TABLE
tags
ADD
COLUMN
id
serial
NOT
NULL
;
UPDATE
tags
SET
id
=
tag_id
;
ALTER
TABLE
tags
DROP
COLUMN
IF
EXISTS
tag_id
;
ALTER
TABLE
tags
DROP
COLUMN
IF
EXISTS
description
;
ALTER
TABLE
tags
ADD
COLUMN
description
TEXT
;
ALTER
TABLE
tags
DROP
COLUMN
IF
EXISTS
parent_id
;
ALTER
TABLE
tags
ADD
COLUMN
parent_id
INT
;
ALTER
TABLE
tags
DROP
COLUMN
IF
EXISTS
creation_date
;
ALTER
TABLE
tags
ADD
COLUMN
creation_date
TIMESTAMP
;
ALTER
TABLE
tags
DROP
COLUMN
IF
EXISTS
links
;
ALTER
TABLE
tags
ADD
COLUMN
links
jsonb
DEFAULT
cast
(
'[]'
as
jsonb
);
ALTER
TABLE
tags
DROP
COLUMN
IF
EXISTS
usage
;
ALTER
TABLE
tags
ADD
COLUMN
usage
TEXT
;
END
IF
;
END
$$
;
SELECT
setval
(
'tags_id_seq'
,
(
SELECT
MAX
(
id
)
from
tags
));
DROP
TABLE
IF
EXISTS
tags_entities
;
DROP
TABLE
IF
EXISTS
resources_tags
;
CREATE
TABLE
resources_tags
(
id
SERIAL
NOT
NULL
,
res_id
INT
,
tag_id
INT
,
CONSTRAINT
resources_tags_id_pkey
PRIMARY
KEY
(
id
)
)
WITH
(
OIDS
=
FALSE
);
INSERT
INTO
resources_tags
(
res_id
,
tag_id
)
SELECT
res_id
,
tag_id
FROM
tag_res
;
DROP
TABLE
IF
EXISTS
tag_res
;
/* DOCTYPES */
DO
$$
BEGIN
IF
(
SELECT
count
(
attname
)
FROM
pg_attribute
WHERE
attrelid
=
(
SELECT
oid
FROM
pg_class
WHERE
relname
=
'mlb_doctype_ext'
))
>
0
THEN
...
...
This diff is collapsed.
Click to expand it.
sql/structure.sql
+
14
−
0
View file @
6e32fcbf
...
...
@@ -901,10 +901,24 @@ CREATE TABLE tags
id
serial
NOT
NULL
,
label
character
varying
(
128
)
NOT
NULL
,
entity_id_owner
character
varying
(
32
),
description
text
,
parent_id
INT
,
creation_date
timestamp
,
links
jsonb
,
usage
text
,
CONSTRAINT
tags_id_pkey
PRIMARY
KEY
(
id
)
)
WITH
(
OIDS
=
FALSE
);
CREATE
TABLE
resources_tags
(
id
SERIAL
NOT
NULL
,
res_id
INT
,
tag_id
INT
,
CONSTRAINT
resources_tags_id_pkey
PRIMARY
KEY
(
id
)
)
WITH
(
OIDS
=
FALSE
);
CREATE
TABLE
tag_res
(
res_id
bigint
NOT
NULL
,
...
...
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