Skip to content

Commit 8341a91

Browse files
committed
Fix constructionDate type
1 parent f9beb29 commit 8341a91

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

migrations/Version20211207231148.php

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 DoctrineMigrations;
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 Version20211207231148 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
24+
25+
$this->addSql('ALTER TABLE tokens CHANGE construction_year construction_year INT DEFAULT NULL');
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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
32+
33+
$this->addSql('ALTER TABLE tokens CHANGE construction_year construction_year DATE DEFAULT NULL');
34+
}
35+
}

src/Entity/Token.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ class Token
290290
private $seriesNumber;
291291

292292
/**
293-
* @ORM\Column(type="date", nullable=true)
293+
* @ORM\Column(type="integer", nullable=true)
294294
*/
295295
private $constructionYear;
296296

@@ -1003,12 +1003,12 @@ public function setSeriesNumber(?int $seriesNumber): self
10031003
return $this;
10041004
}
10051005

1006-
public function getConstructionYear(): ?\DateTimeInterface
1006+
public function getConstructionYear(): ?int
10071007
{
10081008
return $this->constructionYear;
10091009
}
10101010

1011-
public function setConstructionYear(?\DateTimeInterface $constructionYear): self
1011+
public function setConstructionYear(?int $constructionYear): self
10121012
{
10131013
$this->constructionYear = $constructionYear;
10141014

0 commit comments

Comments
 (0)