Skip to content

Commit

Permalink
Mise à jour de l'encoding des tables
Browse files Browse the repository at this point in the history
On a souvent des erreurs dans les logs à cause de tables qui n'acceptent
pas les emojis.

Au lieu de faire la chasse aux tables à chaque fois, ce commit met toute
la base de données à jour en une seule fois.

On change aussi la valeur par défaut pour les futures colonnes et tables
  • Loading branch information
Mopolo authored and stakovicz committed Feb 24, 2025
1 parent 2d49ed6 commit 63d0440
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 1 deletion.
60 changes: 60 additions & 0 deletions db/migrations/20250218154548_update_tables_engine_to_inno_db.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

declare(strict_types=1);


use Phinx\Migration\AbstractMigration;

class UpdateTablesEngineToInnoDb extends AbstractMigration
{
public function change(): void
{
$this->execute("ALTER TABLE `afup_conferenciers_sessions` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_conferenciers` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_contacts` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_cotisations` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_email` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_forum_planning` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_forum_salle` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_forum_sessions_commentaires` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_inscriptions_rappels` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_logs` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_oeuvres` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_pays` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_personnes_morales` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_personnes_physiques` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_planete_billet` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_planete_flux` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_presences_assemblee_generale` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_sessions_note` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_sessions_vote` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_sessions` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_site_article` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_site_feuille` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_site_rubrique` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_tags` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_votes_poids` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `afup_votes` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `annuairepro_ActiviteMembre` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `annuairepro_Activite` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `annuairepro_FormeJuridique` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `annuairepro_MembreAnnuaire_iso` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `annuairepro_MembreAnnuaire_seq` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `annuairepro_MembreAnnuaire` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `annuairepro_TailleSociete` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `annuairepro_Zone` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `compta_categorie` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `compta_evenement` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `compta_operation` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `compta_periode` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `compta_reglement` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `compta_simulation` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `compta` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `rdv_afup` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `wikini_acls` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `wikini_links` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `wikini_pages` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `wikini_referrers` ENGINE=InnoDB;");
$this->execute("ALTER TABLE `wikini_users` ENGINE=InnoDB;");
}
}
94 changes: 94 additions & 0 deletions db/migrations/20250218154608_update_tables_encoding.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?php

declare(strict_types=1);


use Phinx\Migration\AbstractMigration;

class UpdateTablesEncoding extends AbstractMigration
{
public function change(): void
{
$this->execute("ALTER TABLE afup_antenne CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_assemblee_generale CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_assemblee_generale_question CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_badge CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_compta_facture CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_compta_facture_details CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_conferenciers CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_conferenciers_sessions CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_contacts CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_cotisations CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_email CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_facturation_forum CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_forum CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_forum_coupon CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_forum_partenaires CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_forum_planning CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_forum_salle CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_forum_sessions_commentaires CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_forum_special_price CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_forum_sponsor_scan CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_forum_sponsors_tickets CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_forum_tarif CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_forum_tarif_event CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_inscription_forum CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_inscriptions_rappels CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_logs CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_meetup CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_niveau_partenariat CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_oeuvres CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_pays CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_personnes_morales CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_personnes_morales_invitations CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_personnes_physiques CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_personnes_physiques_badge CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_planete_billet CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_planete_flux CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_presences_assemblee_generale CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_sessions CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_sessions_invitation CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_sessions_note CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_sessions_vote CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_sessions_vote_github CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_site_article CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_site_feuille CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_site_rubrique CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_speaker_suggestion CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_subscription_reminder_log CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_tags CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_techletter CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_techletter_subscriptions CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_techletter_unsubscriptions CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_throttling CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_user_github CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_vote_assemblee_generale CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_votes CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE afup_votes_poids CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE annuairepro_Activite CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE annuairepro_ActiviteMembre CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE annuairepro_FormeJuridique CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE annuairepro_MembreAnnuaire CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE annuairepro_MembreAnnuaire_iso CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE annuairepro_TailleSociete CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE annuairepro_Zone CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE compta CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE compta_categorie CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE compta_compte CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE compta_evenement CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE compta_operation CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE compta_periode CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE compta_regle CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE compta_reglement CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE compta_simulation CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE rdv_afup CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE scan CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE sessions CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE tweet CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE wikini_acls CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE wikini_links CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE wikini_pages CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE wikini_referrers CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
$this->execute("ALTER TABLE wikini_users CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;");
}
}
2 changes: 2 additions & 0 deletions docker/dockerfiles/mysql/my.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ skip-name-resolve
innodb_file_per_table=1
sql-mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"
default-time-zone = "+00:00"
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
2 changes: 2 additions & 0 deletions docker/dockerfiles/mysqltest/my.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ skip-name-resolve
innodb_file_per_table=1
sql-mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"
default-time-zone = "+00:00"
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
2 changes: 1 addition & 1 deletion sources/Afup/Forum/Inscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public function obtenirListe($id_forum = null,
FROM afup_personnes_physiques app
LEFT JOIN afup_personnes_morales apm ON apm.id = app.id_personne_morale
LEFT JOIN afup_cotisations ac ON ac.type_personne = IF(apm.id IS NULL, 0, 1) AND ac.id_personne = IFNULL(apm.id, app.id)
WHERE app.email COLLATE latin1_swedish_ci = i.email
WHERE app.email = i.email
GROUP BY app.`id`
)
END AS lastsubscription
Expand Down

0 comments on commit 63d0440

Please sign in to comment.