Etat avec problème d'import Hibernate, cf. https://tree.taiga.io/project/jr-utily-grog-v3/task/184
Showing
9 changed files
with
48 additions
and
68 deletions
migration/creeV3Country.sql
deleted
100644 → 0
1 | -tee creeV3Country.log | ||
2 | - | ||
3 | -create table Country ( | ||
4 | - countryId int(11) NOT NULL AUTO_INCREMENT, | ||
5 | - countryName varchar(100) DEFAULT NULL, | ||
6 | - PRIMARY KEY ('countryId') | ||
7 | -) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
8 | - | ||
9 | -insert into Country (countryId, countryName) | ||
10 | - select ID_PAYS, LIB_PAYS from pays; | ||
11 | - | ||
12 | -show create table Country; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -source normalisePays.sql | ||
2 | -source creeV3Country.sql | ||
3 | -source creeV3Publisher+Version+Action.sql | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +source normalizePays.sql | ||
2 | +source populateV3Country.sql | ||
3 | +source populateV3Publisher+Version+Action.sql | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | tee normalisePays.log | 1 | tee normalisePays.log |
2 | + | ||
3 | +CREATE TABLE pays ( | ||
4 | + ID_PAYS int(11) NOT NULL AUTO_INCREMENT, | ||
5 | + LIB_PAYS varchar(100) DEFAULT NULL, | ||
6 | + PRIMARY KEY (ID_PAYS) | ||
7 | +) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; | ||
8 | + | ||
9 | +insert into pays select * from v2.pays; | ||
10 | + | ||
11 | +CREATE TABLE editeur ( | ||
12 | + ID_EDITEUR int(11) NOT NULL AUTO_INCREMENT, | ||
13 | + NOM_EDITEUR varchar(50) NOT NULL, | ||
14 | + ADR_EDITEUR varchar(300) DEFAULT NULL, | ||
15 | + CP_EDITEUR varchar(15) DEFAULT NULL, | ||
16 | + VILLE varchar(50) DEFAULT NULL, | ||
17 | + PAYS varchar(50) DEFAULT NULL, | ||
18 | + TEL_EDITEUR varchar(25) DEFAULT NULL, | ||
19 | + EMAIL_EDITEUR varchar(50) DEFAULT NULL, | ||
20 | + URL_EDITEUR varchar(100) DEFAULT NULL, | ||
21 | + STATUT_EDITEUR varchar(50) DEFAULT NULL, | ||
22 | + IND_AMATEUR bit(1) DEFAULT NULL, | ||
23 | + HISTORIQUE longtext, | ||
24 | + ID_JOURNALISABLE int(11) DEFAULT NULL, | ||
25 | + ID_LINKABLE int(11) DEFAULT NULL, | ||
26 | + PRIMARY KEY (ID_EDITEUR) | ||
27 | +) ENGINE=InnoDB AUTO_INCREMENT=3267 DEFAULT CHARSET=utf8; | ||
28 | + | ||
29 | +insert into editeur select * from v2.editeur; | ||
30 | + | ||
2 | -- PREPARATION TABLE editeur | 31 | -- PREPARATION TABLE editeur |
3 | -- Standardisation des valeurs de PAYS dans editeur | 32 | -- Standardisation des valeurs de PAYS dans editeur |
4 | update editeur set PAYS='Allemagne' where PAYS in ('Deutschland'); | 33 | update editeur set PAYS='Allemagne' where PAYS in ('Deutschland'); | ... | ... |
migration/populateV3Country.sql
0 → 100644
1 | -tee creeV3Publisher+Version+Action.log | 1 | +tee populateV3Publisher+Version+Action.log |
2 | 2 | ||
3 | SET foreign_key_checks = 0; | 3 | SET foreign_key_checks = 0; |
4 | 4 | ||
5 | -create table Publisher ( | ||
6 | - publisherId int(11) NOT NULL AUTO_INCREMENT, | ||
7 | - validatedVersion_publisherVersionId int(11), | ||
8 | - PRIMARY KEY ('publisherId') | ||
9 | -) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
10 | - | ||
11 | insert into Publisher (publisherId, validatedVersion_publisherVersionId) | 5 | insert into Publisher (publisherId, validatedVersion_publisherVersionId) |
12 | select ID_EDITEUR, ID_EDITEUR from editeur; | 6 | select ID_EDITEUR, ID_EDITEUR from editeur; |
13 | 7 | ||
14 | -create table PublisherVersion ( | ||
15 | - publisherVersionId int(11) NOT NULL AUTO_INCREMENT, | ||
16 | - publisher_publisherId int(11) NOT NULL, | ||
17 | - publisherName varchar(50) NOT NULL, | ||
18 | - publisherStreetAddress varchar(300), | ||
19 | - publisherPostalCode varchar(15), | ||
20 | - publisherPostOfficeBoxNumber varchar(50), | ||
21 | - publisherAddressRegion varchar(50), | ||
22 | - publisherAddressLocality varchar(50), | ||
23 | - publisherAddressCountry_countryId int(11), | ||
24 | - publisherTelephone varchar(25), | ||
25 | - publisherEmail varchar(50), | ||
26 | - publisherURL varchar(100), | ||
27 | - publisherHistory longtext, | ||
28 | - publisherVersionAuthor_userId int(11), | ||
29 | - publisherVersionDatetime DATETIME, | ||
30 | - PRIMARY KEY ('publisherVersionId') | ||
31 | -) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
32 | - | ||
33 | insert into PublisherVersion (publisherVersionId, publisher_publisherId, | 8 | insert into PublisherVersion (publisherVersionId, publisher_publisherId, |
34 | publisherName, publisherStreetAddress, publisherPostalCode, | 9 | publisherName, publisherStreetAddress, publisherPostalCode, |
35 | publisherPostOfficeBoxNumber, publisherAddressRegion, | 10 | publisherPostOfficeBoxNumber, publisherAddressRegion, |
... | @@ -41,8 +16,8 @@ select ID_EDITEUR, ID_EDITEUR, NOM_EDITEUR, ADR_EDITEUR, CP_EDITEUR, NULL, | ... | @@ -41,8 +16,8 @@ select ID_EDITEUR, ID_EDITEUR, NOM_EDITEUR, ADR_EDITEUR, CP_EDITEUR, NULL, |
41 | HISTORIQUE, ID_UTILISATEUR, DATE_ACTION | 16 | HISTORIQUE, ID_UTILISATEUR, DATE_ACTION |
42 | from editeur e | 17 | from editeur e |
43 | left join Country on countryName = e.PAYS | 18 | left join Country on countryName = e.PAYS |
44 | -join journal j on j.ID_JOURNALISABLE = e.ID_EDITEUR | 19 | +join v2.journal j on j.ID_JOURNALISABLE = e.ID_EDITEUR |
45 | -where j.DATE_ACTION = (select max(DATE_ACTION) from journal j2 | 20 | +where j.DATE_ACTION = (select max(DATE_ACTION) from v2.journal j2 |
46 | where j2.ID_JOURNALISABLE = e.ID_EDITEUR) | 21 | where j2.ID_JOURNALISABLE = e.ID_EDITEUR) |
47 | union | 22 | union |
48 | select ID_EDITEUR, ID_EDITEUR, NOM_EDITEUR, ADR_EDITEUR, CP_EDITEUR, NULL, | 23 | select ID_EDITEUR, ID_EDITEUR, NOM_EDITEUR, ADR_EDITEUR, CP_EDITEUR, NULL, |
... | @@ -50,33 +25,17 @@ select ID_EDITEUR, ID_EDITEUR, NOM_EDITEUR, ADR_EDITEUR, CP_EDITEUR, NULL, | ... | @@ -50,33 +25,17 @@ select ID_EDITEUR, ID_EDITEUR, NOM_EDITEUR, ADR_EDITEUR, CP_EDITEUR, NULL, |
50 | HISTORIQUE, null, null | 25 | HISTORIQUE, null, null |
51 | from editeur e | 26 | from editeur e |
52 | left join Country on countryName = e.PAYS | 27 | left join Country on countryName = e.PAYS |
53 | -where ID_EDITEUR not in (select distinct ID_JOURNALISABLE from journal) | 28 | +where ID_EDITEUR not in (select distinct ID_JOURNALISABLE from v2.journal) |
54 | ; | 29 | ; |
55 | 30 | ||
56 | -create table PublisherAction ( | ||
57 | - publisherActionId int(11) NOT NULL AUTO_INCREMENT, | ||
58 | - ActionType TINYINT UNSIGNED NOT NULL, | ||
59 | - publisherActionAuthor_userId int(11) NOT NULL, | ||
60 | - publisherVersion_publisherVersionId int(11) NOT NULL, | ||
61 | - publisherActionDatetime DATETIME, | ||
62 | - publisher_publisherId int(11) NOT NULL, | ||
63 | - PRIMARY KEY ('publisherActionId') | ||
64 | -) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
65 | - | ||
66 | insert into PublisherAction (ActionType, publisherActionAuthor_userId, | 31 | insert into PublisherAction (ActionType, publisherActionAuthor_userId, |
67 | publisherVersion_publisherVersionId, publisherActionDatetime, | 32 | publisherVersion_publisherVersionId, publisherActionDatetime, |
68 | publisher_publisherId) | 33 | publisher_publisherId) |
69 | select 0, ID_UTILISATEUR, ID_EDITEUR, DATE_ACTION, ID_EDITEUR | 34 | select 0, ID_UTILISATEUR, ID_EDITEUR, DATE_ACTION, ID_EDITEUR |
70 | from editeur e | 35 | from editeur e |
71 | -join journal j on j.ID_JOURNALISABLE = e.ID_EDITEUR | 36 | +join v2.journal j on j.ID_JOURNALISABLE = e.ID_EDITEUR |
72 | -where j.DATE_ACTION = (select max(DATE_ACTION) from journal j2 | 37 | +where j.DATE_ACTION = (select max(DATE_ACTION) from v2.journal j2 |
73 | where j2.ID_JOURNALISABLE = e.ID_EDITEUR) | 38 | where j2.ID_JOURNALISABLE = e.ID_EDITEUR) |
74 | ; | 39 | ; |
75 | 40 | ||
76 | -SET foreign_key_checks = 1; | ||
77 | - | ||
78 | -show create table Publisher; | ||
79 | - | ||
80 | -show create table PublisherVersion; | ||
81 | - | ||
82 | -show create table PublisherAction; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
41 | +SET foreign_key_checks = 1; | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -15,7 +15,7 @@ public class JpaConfiguration { | ... | @@ -15,7 +15,7 @@ public class JpaConfiguration { |
15 | */ | 15 | */ |
16 | @Produces | 16 | @Produces |
17 | @RequestScoped | 17 | @RequestScoped |
18 | - @PersistenceContext(unitName = "development-pu") | 18 | + @PersistenceContext(unitName = "migration-pu") |
19 | public EntityManager entityManager; | 19 | public EntityManager entityManager; |
20 | 20 | ||
21 | } | 21 | } | ... | ... |
... | @@ -25,8 +25,8 @@ | ... | @@ -25,8 +25,8 @@ |
25 | <property name="hibernate.connection.CharSet" value="utf8"/> | 25 | <property name="hibernate.connection.CharSet" value="utf8"/> |
26 | <property name="hibernate.connection.characterEncoding" value="utf8"/> | 26 | <property name="hibernate.connection.characterEncoding" value="utf8"/> |
27 | <property name="hibernate.connection.useUnicode" value="true"/> | 27 | <property name="hibernate.connection.useUnicode" value="true"/> |
28 | - <property name="hibernate.hbm2ddl.auto" value="create" /> | 28 | + <property name="hibernate.hbm2ddl.auto" value="create-drop" /> |
29 | - <property name="javax.persistence.hibernate.hbm2ddl.import_files" value=""/> | 29 | + <property name="javax.persistence.hibernate.hbm2ddl.import_files" value="nothing.sql"/> |
30 | <property name="hibernate.hbm2ddl.import_files_sql_extractor" value="org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor" /> | 30 | <property name="hibernate.hbm2ddl.import_files_sql_extractor" value="org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor" /> |
31 | <!-- DDL control OFF | 31 | <!-- DDL control OFF |
32 | <property name="hibernate.show_sql" value="true"/> | 32 | <property name="hibernate.show_sql" value="true"/> |
... | @@ -43,7 +43,6 @@ | ... | @@ -43,7 +43,6 @@ |
43 | <property name="hibernate.connection.CharSet" value="utf8"/> | 43 | <property name="hibernate.connection.CharSet" value="utf8"/> |
44 | <property name="hibernate.connection.characterEncoding" value="utf8"/> | 44 | <property name="hibernate.connection.characterEncoding" value="utf8"/> |
45 | <property name="hibernate.connection.useUnicode" value="true"/> | 45 | <property name="hibernate.connection.useUnicode" value="true"/> |
46 | - <property name="hibernate.hbm2ddl.auto" value="none" /> | ||
47 | <property name="javax.persistence.hibernate.hbm2ddl.import_files" value=""/> | 46 | <property name="javax.persistence.hibernate.hbm2ddl.import_files" value=""/> |
48 | <property name="hibernate.hbm2ddl.import_files_sql_extractor" value="org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor" /> | 47 | <property name="hibernate.hbm2ddl.import_files_sql_extractor" value="org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor" /> |
49 | <!-- DDL control OFF | 48 | <!-- DDL control OFF | ... | ... |
... | @@ -22,7 +22,8 @@ INSERT INTO Country (countryId, countryName) VALUES | ... | @@ -22,7 +22,8 @@ INSERT INTO Country (countryId, countryName) VALUES |
22 | (20, 'Japon'), | 22 | (20, 'Japon'), |
23 | (21, 'Corée du Sud'), | 23 | (21, 'Corée du Sud'), |
24 | (22, 'Pays-Bas'), | 24 | (22, 'Pays-Bas'), |
25 | - (23, 'Hongrie'); | 25 | + (23, 'Hongrie'), |
26 | + (24, 'Tatooine'); | ||
26 | INSERT INTO Account (userId, username, password, firstName, lastName, nickname, email, activated, anonymous, visible, | 27 | INSERT INTO Account (userId, username, password, firstName, lastName, nickname, email, activated, anonymous, visible, |
27 | criticProvider) VALUES | 28 | criticProvider) VALUES |
28 | (1, '1', null, '1f', '1l', '1n', '1@raza.org', TRUE, TRUE, TRUE, TRUE), | 29 | (1, '1', null, '1f', '1l', '1n', '1@raza.org', TRUE, TRUE, TRUE, TRUE), | ... | ... |
src/main/resources/nothing.sql
0 → 100644
File mode changed
-
Please register or login to post a comment