chg: pkg: upgrade to the latest doctrine pkg on back-end #7
This commit is contained in:
@@ -204,8 +204,8 @@ class ProfileController extends AbstractController
|
||||
foreach ($recent as $i => $game) {
|
||||
$isRed = $game->getRed()?->getId() === $userId;
|
||||
$labels[] = '#' . ($i + 1);
|
||||
$mines[] = (int) ($isRed ? $game->getRedPoints() : $game->getBluePoints());
|
||||
$bonus[] = (float) ($isRed ? $game->getRedBonusPoints() : $game->getBlueBonusPoints()) ?: 0;
|
||||
$mines[] = (int)($isRed ? $game->getRedPoints() : $game->getBluePoints());
|
||||
$bonus[] = (float)($isRed ? $game->getRedBonusPoints() : $game->getBlueBonusPoints()) ?: 0;
|
||||
}
|
||||
|
||||
return ['labels' => $labels, 'mines' => $mines, 'bonus' => $bonus];
|
||||
@@ -253,20 +253,20 @@ class ProfileController extends AbstractController
|
||||
}
|
||||
|
||||
return $this->render('Game/battle_share.html.twig', [
|
||||
'game' => $game,
|
||||
'redName' => $redName,
|
||||
'blueName' => $blueName,
|
||||
'redPts' => $redPts,
|
||||
'bluePts' => $bluePts,
|
||||
'resign' => $resign,
|
||||
'redAvatar' => $redAvatar,
|
||||
'blueAvatar' => $blueAvatar,
|
||||
'redBonusPoints' => $redBonusPoints,
|
||||
'blueBonusPoints' => $blueBonusPoints,
|
||||
'redBonusStats' => $redBonusStats,
|
||||
'blueBonusStats' => $blueBonusStats,
|
||||
'ogTitle' => "MineSeeker · $summary",
|
||||
'ogDesc' => "Watch the battle replay: $summary — played on MineSeeker, the multiplayer minesweeper.",
|
||||
'game' => $game,
|
||||
'redName' => $redName,
|
||||
'blueName' => $blueName,
|
||||
'redPts' => $redPts,
|
||||
'bluePts' => $bluePts,
|
||||
'resign' => $resign,
|
||||
'redAvatar' => $redAvatar,
|
||||
'blueAvatar' => $blueAvatar,
|
||||
'redBonusPoints' => $redBonusPoints,
|
||||
'blueBonusPoints' => $blueBonusPoints,
|
||||
'redBonusStats' => $redBonusStats,
|
||||
'blueBonusStats' => $blueBonusStats,
|
||||
'ogTitle' => "MineSeeker · $summary",
|
||||
'ogDesc' => "Watch the battle replay: $summary — played on MineSeeker, the multiplayer minesweeper.",
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -196,7 +196,11 @@ class TwoFactorController extends AbstractController
|
||||
}
|
||||
|
||||
/** Regenerate backup codes for the current user. */
|
||||
#[Route('/profile/security/2fa/backup-codes/regenerate', name: 'MineSeekerBundle_2fa_backup_regenerate', methods: ['POST'])]
|
||||
#[Route(
|
||||
'/profile/security/2fa/backup-codes/regenerate',
|
||||
name: 'MineSeekerBundle_2fa_backup_regenerate',
|
||||
methods: ['POST'],
|
||||
)]
|
||||
public function regenerateBackupCodes(Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of the SplendidBear Websites' projects.
|
||||
*
|
||||
* Copyright (c) 2024 @ www.splendidbear.org
|
||||
*
|
||||
* For the full copyright and licence information, please view the LICENCE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Doctrine;
|
||||
|
||||
use Doctrine\Bundle\DoctrineBundle\Attribute\AsDoctrineListener;
|
||||
use Doctrine\DBAL\Exception;
|
||||
use Doctrine\DBAL\Schema\PostgreSQLSchemaManager;
|
||||
use Doctrine\DBAL\Schema\SchemaException;
|
||||
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
|
||||
use Doctrine\ORM\Tools\ToolEvents;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Class FixPostgreMigrationDefaultSchemaListener
|
||||
*
|
||||
* @package App\Doctrine
|
||||
* @author Lang <https://www.splendidbear.org>
|
||||
* @category Class
|
||||
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html GNU Lesser General Public License
|
||||
* @link www.splendidbear.org
|
||||
* @since 2023. 02. 28.
|
||||
*
|
||||
* @see https://github.com/doctrine/dbal/issues/1110
|
||||
* There is a recent bug when you create new migration, it creates a new schema even if there is no any
|
||||
* changes.
|
||||
*/
|
||||
#[AsDoctrineListener(event: ToolEvents::postGenerateSchema, priority: 500, connection: 'default')]
|
||||
final class FixPostgreMigrationDefaultSchemaListener
|
||||
{
|
||||
public function postGenerateSchema(GenerateSchemaEventArgs $args): void
|
||||
{
|
||||
try {
|
||||
$schemaManager = $args
|
||||
->getEntityManager()
|
||||
->getConnection()
|
||||
->createSchemaManager();
|
||||
|
||||
if (!$schemaManager instanceof PostgreSqlSchemaManager) {
|
||||
return;
|
||||
}
|
||||
|
||||
$schema = $args->getSchema();
|
||||
|
||||
foreach ($schemaManager->getExistingSchemaSearchPaths() as $namespace) {
|
||||
if ($schema->hasNamespace($namespace)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$schema->createNamespace($namespace);
|
||||
}
|
||||
} catch (SchemaException|Exception $e) {
|
||||
throw new RuntimeException($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
63
src/Migrations/2026/04/Version20260419195925.php
Normal file
63
src/Migrations/2026/04/Version20260419195925.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of the SplendidBear Websites' projects.
|
||||
*
|
||||
* Copyright (c) 2026 @ www.splendidbear.org
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Class Version20260419195925
|
||||
*
|
||||
* @package App\Migrations
|
||||
* @author Lang <https://www.splendidbear.org>
|
||||
* @category Class
|
||||
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html GNU Lesser General Public License
|
||||
* @link www.splendidbear.org
|
||||
* @since 2026. 04. 19.
|
||||
*/
|
||||
final class Version20260419195925 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return <<<OUT
|
||||
Upgrade all primary keys to use IDENTITY generation strategy, and add comments to some columns.
|
||||
This is \'cause the Doctrine updgrade.
|
||||
OUT;
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE app_user ALTER id ADD GENERATED BY DEFAULT AS IDENTITY');
|
||||
$this->addSql('ALTER TABLE app_webauthn_credential ALTER id ADD GENERATED BY DEFAULT AS IDENTITY');
|
||||
$this->addSql('ALTER TABLE contact_messages ALTER id ADD GENERATED BY DEFAULT AS IDENTITY');
|
||||
$this->addSql('COMMENT ON COLUMN contact_messages.created_at IS \'\'');
|
||||
$this->addSql('ALTER TABLE gamer ALTER id ADD GENERATED BY DEFAULT AS IDENTITY');
|
||||
$this->addSql('ALTER TABLE grid ALTER id ADD GENERATED BY DEFAULT AS IDENTITY');
|
||||
$this->addSql('ALTER TABLE grid_row ALTER id ADD GENERATED BY DEFAULT AS IDENTITY');
|
||||
$this->addSql('ALTER TABLE played_game ALTER id ADD GENERATED BY DEFAULT AS IDENTITY');
|
||||
$this->addSql('COMMENT ON COLUMN played_game.uuid IS \'\'');
|
||||
$this->addSql('ALTER TABLE step ALTER id ADD GENERATED BY DEFAULT AS IDENTITY');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE app_user ALTER id DROP IDENTITY');
|
||||
$this->addSql('ALTER TABLE app_webauthn_credential ALTER id DROP IDENTITY');
|
||||
$this->addSql('ALTER TABLE contact_messages ALTER id DROP IDENTITY');
|
||||
$this->addSql('COMMENT ON COLUMN contact_messages.created_at IS \'(DC2Type:datetime_immutable)\'');
|
||||
$this->addSql('ALTER TABLE gamer ALTER id DROP IDENTITY');
|
||||
$this->addSql('ALTER TABLE grid ALTER id DROP IDENTITY');
|
||||
$this->addSql('ALTER TABLE grid_row ALTER id DROP IDENTITY');
|
||||
$this->addSql('ALTER TABLE played_game ALTER id DROP IDENTITY');
|
||||
$this->addSql('COMMENT ON COLUMN played_game.uuid IS \'(DC2Type:uuid)\'');
|
||||
$this->addSql('ALTER TABLE step ALTER id DROP IDENTITY');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user