Toggle navigation
Toggle navigation
This project
Loading...
Sign in
grogv3
/
grog-cubi
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
JR Utily
2017-04-30 15:46:14 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
80db09a406ee90d722c7c60497f048bb99c11b82
80db09a4
1 parent
2d2f22ec
adapt migration script to new naming strategy
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
18 deletions
migration/populateV3Account.sql
migration/populateV3Country.sql
migration/populateV3Publisher+Version+Action.sql
migration/populateV3Account.sql
View file @
80db09a
tee
populateV3Account
.
log
insert
into
Account
(
userId
,
username
,
firstName
,
lastN
ame
,
nickname
,
email
,
anonymous
,
visible
,
activated
,
presentation
,
creationDate
,
criticP
rovider
)
INSERT
INTO
ACCOUNT
(
user_id
,
username
,
first_name
,
last_n
ame
,
nickname
,
email
,
anonymous
,
visible
,
activated
,
presentation
,
creation_date
,
critic_p
rovider
)
select
ID_UTILISATEUR
,
LOGIN_UTILISATEUR
,
PRENOM_UTILISATEUR
,
NOM_UTILISATEUR
,
PSEUDO_UTILISATEUR
,
EMAIL_UTILISATEUR
,
IND_ANONYME
,
IND_VISIBLE
,
IND_ACTIVE
,
PRESENTATION
,
DATE_ENREGISTREMENT
,
IND_CRITIQUES
from
roliste
.
utilisateur
;
...
...
migration/populateV3Country.sql
View file @
80db09a
tee
populateV3Country
.
log
insert
into
Country
(
countryId
,
countryN
ame
)
INSERT
INTO
country
(
country_id
,
country_n
ame
)
select
ID_PAYS
,
LIB_PAYS
from
pays
;
\ No newline at end of file
...
...
migration/populateV3Publisher+Version+Action.sql
View file @
80db09a
...
...
@@ -2,35 +2,60 @@ tee populateV3Publisher+Version+Action.log
SET
foreign_key_checks
=
0
;
insert
into
Publisher
(
publisherId
,
validatedVersion_publisherVersionId
)
select
ID_EDITEUR
,
ID_EDITEUR
from
editeur
;
INSERT
INTO
publisher
(
publisher_id
,
validated_version_publisher_version_id
)
SELECT
ID_EDITEUR
,
ID_EDITEUR
FROM
editeur
;
insert
into
PublisherVersion
(
publisherVersionId
,
publisher_publisherId
,
publisherName
,
publisherStreetAddress
,
publisherPostalCode
,
publisherPostOfficeBoxNumber
,
publisherAddressRegion
,
publisherAddressLocality
,
publisherAddressCountry_countryId
,
publisherTelephone
,
publisherEmail
,
publisherURL
,
publisherHistory
,
publisherVersionAuthor_userId
,
publisherVersionDatetime
)
INSERT
INTO
publisher_version
(
publisher_version_id
,
publisher_publisher_id
,
publisher_name
,
publisher_street_address
,
publisher_postal_code
,
publisher_post_office_box_number
,
publisher_address_region
,
publisher_address_locality
,
publisher_address_country_country_id
,
publisher_telephone
,
publisher_email
,
publisherurl
,
publisher_history
,
publisher_version_creator_user_id
,
publisher_version_datetime
)
select
ID_EDITEUR
,
ID_EDITEUR
,
NOM_EDITEUR
,
ADR_EDITEUR
,
CP_EDITEUR
,
NULL
,
NULL
,
VILLE
,
countryId
,
TEL_EDITEUR
,
EMAIL_EDITEUR
,
URL_EDITEUR
,
NULL
,
VILLE
,
country_id
,
TEL_EDITEUR
,
EMAIL_EDITEUR
,
URL_EDITEUR
,
HISTORIQUE
,
ID_UTILISATEUR
,
DATE_ACTION
from
editeur
e
left
join
Country
on
countryN
ame
=
e
.
PAYS
LEFT
JOIN
country
ON
country_n
ame
=
e
.
PAYS
join
roliste
.
journal
j
on
j
.
ID_JOURNALISABLE
=
e
.
ID_EDITEUR
where
j
.
DATE_ACTION
=
(
select
max
(
DATE_ACTION
)
from
roliste
.
journal
j2
where
j2
.
ID_JOURNALISABLE
=
e
.
ID_EDITEUR
)
union
select
ID_EDITEUR
,
ID_EDITEUR
,
NOM_EDITEUR
,
ADR_EDITEUR
,
CP_EDITEUR
,
NULL
,
NULL
,
VILLE
,
countryId
,
TEL_EDITEUR
,
EMAIL_EDITEUR
,
URL_EDITEUR
,
NULL
,
VILLE
,
country_id
,
TEL_EDITEUR
,
EMAIL_EDITEUR
,
URL_EDITEUR
,
HISTORIQUE
,
null
,
null
from
editeur
e
left
join
Country
on
countryN
ame
=
e
.
PAYS
LEFT
JOIN
country
ON
country_n
ame
=
e
.
PAYS
where
ID_EDITEUR
not
in
(
select
distinct
ID_JOURNALISABLE
from
roliste
.
journal
)
;
insert
into
PublisherAction
(
ActionType
,
publisherActionAuthor_userId
,
publisherVersion_publisherVersionId
,
publisherActionDatetime
,
publisher_publisherId
)
INSERT
INTO
publisher_action
(
action_type
,
publisher_action_actor_user_id
,
publisher_version_publisher_version_id
,
publisher_action_datetime
,
publisher_publisher_id
)
select
0
,
ID_UTILISATEUR
,
ID_EDITEUR
,
DATE_ACTION
,
ID_EDITEUR
from
editeur
e
join
roliste
.
journal
j
on
j
.
ID_JOURNALISABLE
=
e
.
ID_EDITEUR
...
...
Please
register
or
login
to post a comment