JR Utily

adapt migration script to new naming strategy

tee populateV3Account.log
insert into Account (userId, username, firstName, lastName, nickname, email, anonymous, visible, activated,
presentation, creationDate, criticProvider)
INSERT INTO ACCOUNT (user_id, username, first_name, last_name, nickname, email, anonymous, visible, activated,
presentation, creation_date, critic_provider)
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;
......
tee populateV3Country.log
insert into Country (countryId, countryName)
INSERT INTO country (country_id, country_name)
select ID_PAYS, LIB_PAYS from pays;
\ No newline at end of file
......
......@@ -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 countryName = e.PAYS
LEFT JOIN country ON country_name = 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 countryName = e.PAYS
LEFT JOIN country ON country_name = 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
......