Skip to content

Commit c197596

Browse files
committed
Recommended changes to author and add migrations
1 parent d63f4ff commit c197596

5 files changed

Lines changed: 69 additions & 3 deletions

File tree

bin/doctrine-fixtures

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ echo "Loading fixtures from: {$fixturesPath}\n";
3535

3636
$executor->execute($loader->getFixtures(), true);
3737

38-
echo "Fixtures loaded successfully!\n";
38+
echo "Fixtures loaded successfully!\n";
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Migration;
6+
7+
use Doctrine\DBAL\Schema\Schema;
8+
use Doctrine\Migrations\AbstractMigration;
9+
10+
/**
11+
* Auto-generated Migration: Please modify to your needs!
12+
*/
13+
final class Version20260722123102 extends AbstractMigration
14+
{
15+
public function getDescription(): string
16+
{
17+
return '';
18+
}
19+
20+
public function up(Schema $schema): void
21+
{
22+
// this up() migration is auto-generated, please modify it to your needs
23+
$this->addSql('DROP INDEX UNIQ_BDAFD8C8E7927C74 ON author');
24+
$this->addSql('ALTER TABLE author DROP email, CHANGE bio github LONGTEXT DEFAULT NULL');
25+
$this->addSql('CREATE UNIQUE INDEX UNIQ_BDAFD8C8637CABE9 ON author (github)');
26+
}
27+
28+
public function down(Schema $schema): void
29+
{
30+
// this down() migration is auto-generated, please modify it to your needs
31+
$this->addSql('DROP INDEX UNIQ_BDAFD8C8637CABE9 ON author');
32+
$this->addSql('ALTER TABLE author ADD email LONGTEXT NOT NULL, CHANGE github bio LONGTEXT DEFAULT NULL');
33+
$this->addSql('CREATE UNIQUE INDEX UNIQ_BDAFD8C8E7927C74 ON author (email)');
34+
}
35+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Migration;
6+
7+
use Doctrine\DBAL\Schema\Schema;
8+
use Doctrine\Migrations\AbstractMigration;
9+
10+
/**
11+
* Auto-generated Migration: Please modify to your needs!
12+
*/
13+
final class Version20260723072400 extends AbstractMigration
14+
{
15+
public function getDescription(): string
16+
{
17+
return '';
18+
}
19+
20+
public function up(Schema $schema): void
21+
{
22+
// this up() migration is auto-generated, please modify it to your needs
23+
$this->addSql('ALTER TABLE author CHANGE github github VARCHAR(191) DEFAULT NULL');
24+
}
25+
26+
public function down(Schema $schema): void
27+
{
28+
// this down() migration is auto-generated, please modify it to your needs
29+
$this->addSql('ALTER TABLE author CHANGE github github LONGTEXT DEFAULT NULL');
30+
}
31+
}

src/Blog/src/Entity/Author.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Author extends AbstractEntity
1919
#[ORM\Column(name: 'slug', type: 'text', unique: true)]
2020
private string $slug;
2121

22-
#[ORM\Column(name: 'github', type: 'text', unique: true, nullable: true)]
22+
#[ORM\Column(name: 'github', type: 'string', length: 191, unique: true, nullable: true)]
2323
private ?string $github = null;
2424

2525
public function getName(): string

src/Blog/templates/page/author-resource.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<path d="M4 20c0-3.3 3.6-5 8-5s8 1.7 8 5"/>
2020
</svg>
2121
</span>
22-
{% if author.github and author.github is not null %}
22+
{% if author.github %}
2323
<a href="https://github.com/{{ author.github }}" target="_blank" rel="noopener noreferrer" class="author-github d-inline-flex align-items-center gap-2 text-decoration-none">
2424
<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true" class="flex-shrink-0">
2525
<path d="M12 .5C5.73.5.5 5.73.5 12c0 5.09 3.29 9.4 7.86 10.93.57.1.79-.25.79-.55 0-.27-.01-1.17-.02-2.12-3.2.7-3.88-1.36-3.88-1.36-.52-1.34-1.28-1.7-1.28-1.7-1.05-.72.08-.7.08-.7 1.16.08 1.77 1.19 1.77 1.19 1.03 1.77 2.7 1.26 3.36.96.1-.75.4-1.26.73-1.55-2.55-.29-5.24-1.28-5.24-5.7 0-1.26.45-2.29 1.19-3.1-.12-.29-.52-1.46.11-3.05 0 0 .97-.31 3.18 1.18a11 11 0 0 1 5.8 0c2.2-1.49 3.17-1.18 3.17-1.18.63 1.59.24 2.76.12 3.05.74.81 1.19 1.84 1.19 3.1 0 4.43-2.7 5.4-5.27 5.69.42.36.78 1.07.78 2.16 0 1.56-.01 2.82-.01 3.2 0 .31.21.66.8.55A11.5 11.5 0 0 0 23.5 12c0-6.27-5.23-11.5-11.5-11.5z"/>

0 commit comments

Comments
 (0)