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
9d7dd788
Commit
9d7dd788
authored
4 years ago
by
Florian Azizian
Browse files
Options
Downloads
Patches
Plain Diff
FIX #10852 improve 1904 migration (redirected_baskets)
parent
d23e9f37
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
migration/19.04/1904.sql
+21
-18
21 additions, 18 deletions
migration/19.04/1904.sql
with
21 additions
and
18 deletions
migration/19.04/1904.sql
+
21
−
18
View file @
9d7dd788
...
...
@@ -5,7 +5,7 @@
-- --
-- --
-- *************************************************************************--
UPDATE
parameters
SET
param_value_string
=
'19.04.
6
'
WHERE
id
=
'database_version'
;
UPDATE
parameters
SET
param_value_string
=
'19.04.
17
'
WHERE
id
=
'database_version'
;
DELETE
FROM
parameters
WHERE
id
=
'QrCodePrefix'
;
INSERT
INTO
parameters
(
id
,
description
,
param_value_int
)
VALUES
(
'QrCodePrefix'
,
'Si activé (1), ajoute "Maarch_" dans le contenu des QrCode générés. (Utilisable avec MaarchCapture >= 1.4)'
,
0
);
...
...
@@ -23,30 +23,33 @@ ALTER TABLE users ADD COLUMN external_id jsonb DEFAULT '{}';
/* Redirected Baskets */
DO
$$
BEGIN
IF
(
SELECT
count
(
TABLE_NAME
)
FROM
INFORMATION_SCHEMA
.
TABLES
WHERE
TABLE_NAME
=
'user_abs'
)
=
1
THEN
DROP
TABLE
IF
EXISTS
redirected_baskets
;
CREATE
TABLE
redirected_baskets
(
id
serial
NOT
NULL
,
actual_user_id
INTEGER
NOT
NULL
,
owner_user_id
INTEGER
NOT
NULL
,
basket_id
character
varying
(
255
)
NOT
NULL
,
group_id
INTEGER
NOT
NULL
,
CONSTRAINT
redirected_baskets_pkey
PRIMARY
KEY
(
id
),
CONSTRAINT
redirected_baskets_unique_key
UNIQUE
(
owner_user_id
,
basket_id
,
group_id
)
)
WITH
(
OIDS
=
FALSE
);
INSERT
INTO
redirected_baskets
(
owner_user_id
,
actual_user_id
,
basket_id
,
group_id
)
SELECT
users
.
id
,
us
.
id
,
user_abs
.
basket_id
,
usergroups
.
id
FROM
usergroups
,
usergroup_content
,
user_abs
,
groupbasket
,
users
,
users
us
where
usergroup_content
.
group_id
=
usergroups
.
group_id
DROP
TABLE
IF
EXISTS
redirected_baskets
;
CREATE
TABLE
redirected_baskets
(
id
serial
NOT
NULL
,
actual_user_id
INTEGER
NOT
NULL
,
owner_user_id
INTEGER
NOT
NULL
,
basket_id
character
varying
(
255
)
NOT
NULL
,
group_id
INTEGER
NOT
NULL
,
CONSTRAINT
redirected_baskets_pkey
PRIMARY
KEY
(
id
),
CONSTRAINT
redirected_baskets_unique_key
UNIQUE
(
owner_user_id
,
basket_id
,
group_id
)
)
WITH
(
OIDS
=
FALSE
);
INSERT
INTO
redirected_baskets
(
owner_user_id
,
actual_user_id
,
basket_id
,
group_id
)
SELECT
users
.
id
,
us
.
id
,
user_abs
.
basket_id
,
usergroups
.
id
FROM
usergroups
,
usergroup_content
,
user_abs
,
groupbasket
,
users
,
users
us
WHERE
usergroup_content
.
group_id
=
usergroups
.
group_id
and
usergroup_content
.
user_id
=
user_abs
.
basket_owner
and
users
.
user_id
=
user_abs
.
basket_owner
and
us
.
user_id
=
user_abs
.
new_user
and
groupbasket
.
group_id
=
usergroup_content
.
group_id
and
groupbasket
.
basket_id
=
user_abs
.
basket_id
;
and
groupbasket
.
basket_id
=
user_abs
.
basket_id
ON
CONFLICT
DO
NOTHING
;
DROP
TABLE
IF
EXISTS
user_abs
;
DROP
TABLE
IF
EXISTS
user_abs
;
END
IF
;
END
$$
;
UPDATE
history
SET
table_name
=
'redirected_baskets'
WHERE
table_name
=
'user_abs'
;
/* CONFIGURATIONS */
...
...
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