Add default value for calendarorder column following #35

This commit is contained in:
tchapi 2021-09-28 15:38:46 +02:00
parent cef0780a6f
commit 4f6fc9ed01
2 changed files with 30 additions and 1 deletions

View File

@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Add default value for calendar order.
*/
final class Version20210928132307 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add default value for calendar order.';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE calendarinstances CHANGE calendarorder calendarorder INT DEFAULT 0 NOT NULL');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE calendarinstances CHANGE calendarorder calendarorder INT NOT NULL');
}
}

View File

@ -66,7 +66,7 @@ class CalendarInstance
private $description;
/**
* @ORM\Column(name="calendarorder", type="integer")
* @ORM\Column(name="calendarorder", type="integer", options={"default" : 0})
*/
private $calendarOrder;