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
d9aeadf7
Verified
Commit
d9aeadf7
authored
4 years ago
by
Damien
Browse files
Options
Downloads
Patches
Plain Diff
FEAT #13678 TIME 0:25 Refactoring basket_persistent user_id
parent
150fc829
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
migration/20.10/2010.sql
+12
-2
12 additions, 2 deletions
migration/20.10/2010.sql
sql/structure.sql
+1
-1
1 addition, 1 deletion
sql/structure.sql
src/app/action/controllers/ActionMethodController.php
+4
-4
4 additions, 4 deletions
src/app/action/controllers/ActionMethodController.php
with
17 additions
and
7 deletions
migration/20.10/2010.sql
+
12
−
2
View file @
d9aeadf7
...
...
@@ -43,10 +43,20 @@ DO $$ BEGIN
UPDATE
res_letterbox
set
dest_user_tmp
=
(
select
id
FROM
users
where
users
.
user_id
=
res_letterbox
.
dest_user
);
ALTER
TABLE
res_letterbox
DROP
COLUMN
IF
EXISTS
dest_user
;
ALTER
TABLE
res_letterbox
RENAME
COLUMN
dest_user_tmp
TO
dest_user
;
UPDATE
baskets
SET
basket_clause
=
REGEXP_REPLACE
(
basket_clause
,
'dest_user(
\s
*)=(
\s
*)@user'
,
'dest_user = @user_id'
,
'gmi'
);
UPDATE
security
SET
where_clause
=
REGEXP_REPLACE
(
where_clause
,
'dest_user(
\s
*)=(
\s
*)@user'
,
'dest_user = @user_id'
,
'gmi'
);
END
IF
;
END
$$
;
DO
$$
BEGIN
IF
(
SELECT
count
(
column_name
)
from
information_schema
.
columns
where
table_name
=
'basket_persistent_mode'
and
column_name
=
'user_id'
and
data_type
!=
'integer'
)
THEN
ALTER
TABLE
basket_persistent_mode
ADD
COLUMN
user_id_tmp
INTEGER
;
UPDATE
basket_persistent_mode
set
user_id_tmp
=
(
select
id
FROM
users
where
users
.
user_id
=
basket_persistent_mode
.
user_id
);
DELETE
FROM
basket_persistent_mode
WHERE
user_id_tmp
IS
NULL
;
ALTER
TABLE
basket_persistent_mode
ALTER
COLUMN
user_id_tmp
set
not
null
;
ALTER
TABLE
basket_persistent_mode
DROP
COLUMN
IF
EXISTS
user_id
;
ALTER
TABLE
basket_persistent_mode
RENAME
COLUMN
user_id_tmp
TO
user_id
;
END
IF
;
END
$$
;
UPDATE
baskets
SET
basket_clause
=
REGEXP_REPLACE
(
basket_clause
,
'dest_user(
\s
*)=(
\s
*)@user'
,
'dest_user = @user_id'
,
'gmi'
);
UPDATE
security
SET
where_clause
=
REGEXP_REPLACE
(
where_clause
,
'dest_user(
\s
*)=(
\s
*)@user'
,
'dest_user = @user_id'
,
'gmi'
);
/* RE CREATE VIEWS */
...
...
This diff is collapsed.
Click to expand it.
sql/structure.sql
+
1
−
1
View file @
d9aeadf7
...
...
@@ -330,7 +330,7 @@ WITH (OIDS=FALSE);
CREATE
TABLE
basket_persistent_mode
(
res_id
bigint
,
user_id
character
varying
(
128
)
,
user_id
INTEGER
not
null
,
is_persistent
character
varying
(
1
)
)
WITH
(
...
...
This diff is collapsed.
Click to expand it.
src/app/action/controllers/ActionMethodController.php
+
4
−
4
View file @
d9aeadf7
...
...
@@ -193,12 +193,12 @@ class ActionMethodController
BasketPersistenceModel
::
delete
([
'where'
=>
[
'res_id = ?'
,
'user_id = ?'
],
'data'
=>
[
$aArgs
[
'resId'
],
$GLOBALS
[
'
userI
d'
]]
'data'
=>
[
$aArgs
[
'resId'
],
$GLOBALS
[
'
i
d'
]]
]);
BasketPersistenceModel
::
create
([
'res_id'
=>
$aArgs
[
'resId'
],
'user_id'
=>
$GLOBALS
[
'
userI
d'
],
'user_id'
=>
$GLOBALS
[
'
i
d'
],
'is_persistent'
=>
'N'
]);
...
...
@@ -212,12 +212,12 @@ class ActionMethodController
BasketPersistenceModel
::
delete
([
'where'
=>
[
'res_id = ?'
,
'user_id = ?'
],
'data'
=>
[
$aArgs
[
'resId'
],
$GLOBALS
[
'
userI
d'
]]
'data'
=>
[
$aArgs
[
'resId'
],
$GLOBALS
[
'
i
d'
]]
]);
BasketPersistenceModel
::
create
([
'res_id'
=>
$aArgs
[
'resId'
],
'user_id'
=>
$GLOBALS
[
'
userI
d'
],
'user_id'
=>
$GLOBALS
[
'
i
d'
],
'is_persistent'
=>
'Y'
]);
...
...
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