Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clinicaltrials
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
david Chavalarias
clinicaltrials
Commits
96c120db
Commit
96c120db
authored
Feb 24, 2017
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
snippet to create a scholar copy for maintenance and test cases
parent
28d675b3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
create_a_copy_scholar.sql
setup/toolbox/create_a_copy_scholar.sql
+15
-0
No files found.
setup/toolbox/create_a_copy_scholar.sql
0 → 100644
View file @
96c120db
-- we copy the informations from an old_luid to a new row with a new email
SET
@
old_luid
=
'1234'
;
SET
@
new_email
=
'some_testing_email@domain.org'
;
-- copy all scholar-table info except mail and uids
INSERT
INTO
scholars
(
email
,
country
,
first_name
,
middle_name
,
last_name
,
initials
,
affiliation_id
,
position
,
hon_title
,
interests_text
,
gender
,
job_looking
,
job_looking_date
,
home_url
,
pic_url
,
pic_fname
,
valid_date
,
record_status
)
SELECT
@
new_email
,
country
,
first_name
,
middle_name
,
last_name
,
initials
,
affiliation_id
,
position
,
hon_title
,
interests_text
,
gender
,
job_looking
,
job_looking_date
,
home_url
,
pic_url
,
pic_fname
,
valid_date
,
record_status
FROM
scholars
WHERE
luid
=
@
old_luid
;
-- we have a new UID
SET
@
new_luid
=
LAST_INSERT_ID
()
;
-- copy all keywords & hashtags
INSERT
INTO
sch_kw
SELECT
@
new_luid
,
kwid
FROM
sch_kw
WHERE
uid
=
@
old_luid
;
INSERT
INTO
sch_ht
SELECT
@
new_luid
,
htid
FROM
sch_ht
WHERE
uid
=
@
old_luid
;
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