JR Utily

adapt migration script to new naming strategy

1 tee populateV3Account.log 1 tee populateV3Account.log
2 2
3 -insert into Account (userId, username, firstName, lastName, nickname, email, anonymous, visible, activated, 3 +INSERT INTO ACCOUNT (user_id, username, first_name, last_name, nickname, email, anonymous, visible, activated,
4 - presentation, creationDate, criticProvider) 4 +presentation, creation_date, critic_provider)
5 select ID_UTILISATEUR, LOGIN_UTILISATEUR, PRENOM_UTILISATEUR, NOM_UTILISATEUR, PSEUDO_UTILISATEUR, 5 select ID_UTILISATEUR, LOGIN_UTILISATEUR, PRENOM_UTILISATEUR, NOM_UTILISATEUR, PSEUDO_UTILISATEUR,
6 EMAIL_UTILISATEUR, IND_ANONYME, IND_VISIBLE, IND_ACTIVE, PRESENTATION, DATE_ENREGISTREMENT, IND_CRITIQUES 6 EMAIL_UTILISATEUR, IND_ANONYME, IND_VISIBLE, IND_ACTIVE, PRESENTATION, DATE_ENREGISTREMENT, IND_CRITIQUES
7 from roliste.utilisateur; 7 from roliste.utilisateur;
......
1 tee populateV3Country.log 1 tee populateV3Country.log
2 2
3 -insert into Country (countryId, countryName) 3 +INSERT INTO country (country_id, country_name)
4 select ID_PAYS, LIB_PAYS from pays; 4 select ID_PAYS, LIB_PAYS from pays;
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -2,35 +2,60 @@ tee populateV3Publisher+Version+Action.log ...@@ -2,35 +2,60 @@ tee populateV3Publisher+Version+Action.log
2 2
3 SET foreign_key_checks = 0; 3 SET foreign_key_checks = 0;
4 4
5 -insert into Publisher (publisherId, validatedVersion_publisherVersionId) 5 +INSERT INTO publisher (publisher_id, validated_version_publisher_version_id)
6 - select ID_EDITEUR, ID_EDITEUR from editeur; 6 + SELECT
7 + ID_EDITEUR,
8 + ID_EDITEUR
9 + FROM editeur;
7 10
8 -insert into PublisherVersion (publisherVersionId, publisher_publisherId, 11 +INSERT INTO publisher_version (
9 - publisherName, publisherStreetAddress, publisherPostalCode, 12 + publisher_version_id,
10 - publisherPostOfficeBoxNumber, publisherAddressRegion, 13 + publisher_publisher_id,
11 - publisherAddressLocality, publisherAddressCountry_countryId, 14 + publisher_name,
12 - publisherTelephone, publisherEmail, publisherURL, 15 + publisher_street_address,
13 - publisherHistory, publisherVersionAuthor_userId, publisherVersionDatetime) 16 + publisher_postal_code,
17 + publisher_post_office_box_number,
18 + publisher_address_region,
19 + publisher_address_locality,
20 + publisher_address_country_country_id,
21 + publisher_telephone,
22 + publisher_email,
23 + publisherurl,
24 + publisher_history,
25 + publisher_version_creator_user_id,
26 + publisher_version_datetime
27 +)
14 select ID_EDITEUR, ID_EDITEUR, NOM_EDITEUR, ADR_EDITEUR, CP_EDITEUR, NULL, 28 select ID_EDITEUR, ID_EDITEUR, NOM_EDITEUR, ADR_EDITEUR, CP_EDITEUR, NULL,
15 - NULL, VILLE, countryId, TEL_EDITEUR, EMAIL_EDITEUR, URL_EDITEUR, 29 + NULL,
30 + VILLE,
31 + country_id,
32 + TEL_EDITEUR,
33 + EMAIL_EDITEUR,
34 + URL_EDITEUR,
16 HISTORIQUE, ID_UTILISATEUR, DATE_ACTION 35 HISTORIQUE, ID_UTILISATEUR, DATE_ACTION
17 from editeur e 36 from editeur e
18 -left join Country on countryName = e.PAYS 37 + LEFT JOIN country ON country_name = e.PAYS
19 join roliste.journal j on j.ID_JOURNALISABLE = e.ID_EDITEUR 38 join roliste.journal j on j.ID_JOURNALISABLE = e.ID_EDITEUR
20 where j.DATE_ACTION = (select max(DATE_ACTION) from roliste.journal j2 39 where j.DATE_ACTION = (select max(DATE_ACTION) from roliste.journal j2
21 where j2.ID_JOURNALISABLE = e.ID_EDITEUR) 40 where j2.ID_JOURNALISABLE = e.ID_EDITEUR)
22 union 41 union
23 select ID_EDITEUR, ID_EDITEUR, NOM_EDITEUR, ADR_EDITEUR, CP_EDITEUR, NULL, 42 select ID_EDITEUR, ID_EDITEUR, NOM_EDITEUR, ADR_EDITEUR, CP_EDITEUR, NULL,
24 - NULL, VILLE, countryId, TEL_EDITEUR, EMAIL_EDITEUR, URL_EDITEUR, 43 + NULL,
44 + VILLE,
45 + country_id,
46 + TEL_EDITEUR,
47 + EMAIL_EDITEUR,
48 + URL_EDITEUR,
25 HISTORIQUE, null, null 49 HISTORIQUE, null, null
26 from editeur e 50 from editeur e
27 -left join Country on countryName = e.PAYS 51 + LEFT JOIN country ON country_name = e.PAYS
28 where ID_EDITEUR not in (select distinct ID_JOURNALISABLE from roliste.journal) 52 where ID_EDITEUR not in (select distinct ID_JOURNALISABLE from roliste.journal)
29 ; 53 ;
30 54
31 -insert into PublisherAction (ActionType, publisherActionAuthor_userId, 55 +
32 - publisherVersion_publisherVersionId, publisherActionDatetime, 56 +INSERT INTO publisher_action (action_type, publisher_action_actor_user_id,
33 - publisher_publisherId) 57 + publisher_version_publisher_version_id, publisher_action_datetime,
58 + publisher_publisher_id)
34 select 0, ID_UTILISATEUR, ID_EDITEUR, DATE_ACTION, ID_EDITEUR 59 select 0, ID_UTILISATEUR, ID_EDITEUR, DATE_ACTION, ID_EDITEUR
35 from editeur e 60 from editeur e
36 join roliste.journal j on j.ID_JOURNALISABLE = e.ID_EDITEUR 61 join roliste.journal j on j.ID_JOURNALISABLE = e.ID_EDITEUR
......