Skip to content

Commit 0d08d61

Browse files
authored
#1564 mariadb to mysql (#1565)
* issue#1564 change database image * issue#1564 fix fixtures * issue#1564 fix tests * issue#1564 sql schema * issue#1564 lint compose.yml
1 parent 9acde78 commit 0d08d61

26 files changed

+111
-67
lines changed

compose.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: "2.2"
2-
31
services:
42
db:
53
build: ./docker/dockerfiles/mysql
@@ -21,7 +19,7 @@ services:
2119
volumes:
2220
- ./data/mysqltest:/var/lib/mysql
2321
healthcheck:
24-
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
22+
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost" ]
2523
timeout: 20s
2624
retries: 10
2725

@@ -58,7 +56,7 @@ services:
5856
links:
5957
- statictestresources
6058
healthcheck:
61-
test: ["CMD", "curl", "-f", "https://apachephptest:80"]
59+
test: [ "CMD", "curl", "-f", "https://apachephptest:80" ]
6260
interval: 30s
6361
timeout: 10s
6462
retries: 5
@@ -76,8 +74,8 @@ services:
7674
.env
7775
user: localUser
7876
volumes:
79-
- ./data/composer:/home/localUser/.composer
80-
- ./:/var/www/html
77+
- ./data/composer:/home/localUser/.composer
78+
- ./:/var/www/html
8179
links:
8280
- db
8381
- apachephp

db/migrations/20180526091813_init.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,8 @@ CREATE TABLE `afup_forum` (
394394
`trello_list_id` varchar(100) CHARACTER SET utf8 DEFAULT NULL,
395395
`logo_url` varchar(100) CHARACTER SET utf8 DEFAULT NULL,
396396
`nb_places` int(11) unsigned NOT NULL DEFAULT '0',
397-
`date_debut` date NOT NULL DEFAULT '0000-00-00',
398-
`date_fin` date NOT NULL DEFAULT '0000-00-00',
397+
`date_debut` date NULL,
398+
`date_fin` date NULL,
399399
`annee` int(11) DEFAULT NULL,
400400
`text` text,
401401
`date_fin_appel_projet` int(11) DEFAULT NULL,
@@ -935,7 +935,7 @@ DROP TABLE IF EXISTS `afup_sessions`;
935935
CREATE TABLE `afup_sessions` (
936936
`session_id` int(11) NOT NULL AUTO_INCREMENT,
937937
`id_forum` smallint(6) NOT NULL DEFAULT '0',
938-
`date_soumission` date NOT NULL DEFAULT '0000-00-00',
938+
`date_soumission` date NOT NULL,
939939
`titre` varchar(255) NOT NULL DEFAULT '',
940940
`abstract` text NOT NULL,
941941
`staff_notes` text,
@@ -985,7 +985,7 @@ CREATE TABLE `afup_sessions_note` (
985985
`session_id` int(11) NOT NULL DEFAULT '0',
986986
`note` tinyint(4) NOT NULL DEFAULT '0',
987987
`salt` char(32) NOT NULL DEFAULT '',
988-
`date_soumission` date NOT NULL DEFAULT '0000-00-00',
988+
`date_soumission` date NOT NULL,
989989
PRIMARY KEY (`note`,`session_id`,`salt`) USING BTREE
990990
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
991991
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -1441,7 +1441,7 @@ CREATE TABLE `compta` (
14411441
`attachment_filename` varchar(255) DEFAULT NULL,
14421442
`numero` varchar(50) NOT NULL,
14431443
`idmode_regl` tinyint(5) NOT NULL,
1444-
`date_regl` date NOT NULL,
1444+
`date_regl` date NULL,
14451445
`obs_regl` varchar(255) NOT NULL,
14461446
`idevenement` tinyint(5) NOT NULL,
14471447
`idcompte` tinyint(2) NOT NULL DEFAULT '1',
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
use Phinx\Migration\AbstractMigration;
4+
5+
class MariaDBToMysql extends AbstractMigration
6+
{
7+
public function change()
8+
{
9+
$this->execute("ALTER TABLE afup_sessions ALTER COLUMN skill SET DEFAULT 0");
10+
$this->execute("ALTER TABLE afup_forum MODIFY date_debut date NULL");
11+
$this->execute("ALTER TABLE afup_forum MODIFY date_fin date NULL");
12+
$this->execute("ALTER TABLE afup_sessions ALTER COLUMN has_allowed_to_sharing_with_local_offices SET DEFAULT 0");
13+
$this->execute("ALTER TABLE compta MODIFY idevenement TINYINT(5) NULL");
14+
$this->execute("ALTER TABLE compta MODIFY date_regl date NULL");
15+
$this->execute("ALTER TABLE compta_categorie MODIFY idevenement TINYINT(5) NULL");
16+
$this->execute("ALTER TABLE afup_compta_facture MODIFY date_facture DATE NULL");
17+
$this->execute("ALTER TABLE afup_compta_facture MODIFY numero_facture VARCHAR(50) NULL");
18+
$this->execute("ALTER TABLE compta MODIFY idclef VARCHAR(20) NULL");
19+
$this->execute("ALTER TABLE afup_inscription_forum MODIFY transport_mode SMALLINT NULL");
20+
}
21+
}
22+

db/seeds/Compta.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function run()
6969
'idoperation' => 0,
7070
'idcategorie' => 0,
7171
'idmode_regl' => 0,
72-
'date_regl' => '0000-00-00',
72+
'date_regl' => null,
7373
'idevenement' => 0,
7474
],
7575
[
@@ -89,7 +89,7 @@ public function run()
8989
'idoperation' => 0,
9090
'idcategorie' => 0,
9191
'idmode_regl' => 0,
92-
'date_regl' => '0000-00-00',
92+
'date_regl' => null,
9393
'idevenement' => 0,
9494
],
9595
];

db/seeds/Event.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function run()
4040
'date_fin_saisie_nuites_hotel' => $event - $oneDayInSeconds * 7,
4141
'place_name' => 'Paris',
4242
'place_address' => 'Marriott Rive Gauche',
43-
'date_annonce_planning' => date('Y-m-d H:i:s', $now - $oneMonthInSeconds),
43+
'date_annonce_planning' => $now - $oneMonthInSeconds,
4444
'transport_information_enabled' => 1,
4545
'has_prices_defined_with_vat' => 1,
4646
],
@@ -70,7 +70,7 @@ public function run()
7070
'date_fin_saisie_nuites_hotel' => $event - $oneDayInSeconds * 7,
7171
'place_name' => 'Paris',
7272
'place_address' => 'Marriott Rive Gauche',
73-
'date_annonce_planning' => date('Y-m-d H:i:s', $now - $oneMonthInSeconds),
73+
'date_annonce_planning' => $now - $oneMonthInSeconds,
7474
'transport_information_enabled' => 1,
7575
'has_prices_defined_with_vat' => 1,
7676
],

docker/dockerfiles/mysql/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM mariadb:10.0.29
1+
FROM mysql:5.7
22

33
COPY my.cnf /etc/mysql/my.cnf
44
COPY mysql /opt/mysql

docker/dockerfiles/mysql/my.cnf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
skip-host-cache
33
skip-name-resolve
44
innodb_file_per_table=1
5+
sql-mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"

docker/dockerfiles/mysqltest/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM mariadb:10.0.29
1+
FROM mysql:5.7
22

33
COPY my.cnf /etc/mysql/my.cnf
44
COPY mysql /opt/mysql

docker/dockerfiles/mysqltest/my.cnf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
skip-host-cache
33
skip-name-resolve
44
innodb_file_per_table=1
5+
sql-mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"

htdocs/pages/administration/compta_devis.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ function prepareDefaultsFromComptaFacId(Facture $comptaFact, $id) {
239239
$ok = $comptaFact->ajouter_details(
240240
$valeur['ref'.$i],
241241
$valeur['designation'.$i],
242-
$valeur['quantite'.$i],
243-
$valeur['pu'.$i],
244-
$valeur['tva'.$i]
242+
(int)$valeur['quantite'.$i],
243+
(float)$valeur['pu'.$i],
244+
(int)$valeur['tva'.$i]
245245
);
246246
}
247247
} else {
@@ -264,7 +264,7 @@ function prepareDefaultsFromComptaFacId(Facture $comptaFact, $id) {
264264
$valeur['ref_clt2'],
265265
$valeur['ref_clt3'],
266266
$valeur['numero_devis'],
267-
$valeur['numero_facture'],
267+
$valeur['numero_facture'] ?? null,
268268
0,
269269
null,
270270
$valeur['devise_facture']
@@ -275,9 +275,9 @@ function prepareDefaultsFromComptaFacId(Facture $comptaFact, $id) {
275275
$valeur['id'.$i],
276276
$valeur['ref'.$i],
277277
$valeur['designation'.$i],
278-
$valeur['quantite'.$i],
279-
$valeur['pu'.$i],
280-
$valeur['tva'.$i]
278+
(int)$valeur['quantite'.$i],
279+
(float)$valeur['pu'.$i],
280+
(int)$valeur['tva'.$i]
281281
);
282282
}
283283

0 commit comments

Comments
 (0)