Skip to content

Commit

Permalink
Switch to MEDIUMTEXT for card and calendar data
Browse files Browse the repository at this point in the history
  • Loading branch information
tchapi committed Dec 29, 2023
1 parent 2012dcf commit f2e08c9
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 3 deletions.
37 changes: 37 additions & 0 deletions migrations/Version20231229203515.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Scale up to MEDIUMTEXT for calendar and card data https://github.com/tchapi/davis/pull/111#issuecomment-1872295498
*/
final class Version20231229203515 extends AbstractMigration
{
public function getDescription(): string
{
return 'Scale up to MEDIUMTEXT for calendar and card data';
}

public function up(Schema $schema): void
{
$this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration is specific to \'mysql\'. Skipping it is fine.');

$this->addSql('ALTER TABLE calendarobjects CHANGE calendardata calendardata MEDIUMTEXT DEFAULT NULL');
$this->addSql('ALTER TABLE cards CHANGE carddata carddata MEDIUMTEXT DEFAULT NULL');
$this->addSql('ALTER TABLE schedulingobjects CHANGE calendardata calendardata MEDIUMTEXT DEFAULT NULL');
}

public function down(Schema $schema): void
{
$this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration is specific to \'mysql\'. Skipping it is fine.');

$this->addSql('ALTER TABLE schedulingobjects CHANGE calendardata calendardata TEXT DEFAULT NULL');
$this->addSql('ALTER TABLE calendarobjects CHANGE calendardata calendardata TEXT DEFAULT NULL');
$this->addSql('ALTER TABLE cards CHANGE carddata carddata TEXT DEFAULT NULL');
}
}
3 changes: 2 additions & 1 deletion src/Entity/CalendarObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class CalendarObject
private $id;

/**
* @ORM\Column(name="calendardata", type="text", nullable=true, length=65535)
* @ORM\Column(name="calendardata", type="text", nullable=true, length=16777215)
* The length corresponds to MEDIUMTEXT in MySQL
*/
private $calendarData;

Expand Down
3 changes: 2 additions & 1 deletion src/Entity/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class Card
private $addressBook;

/**
* @ORM\Column(name="carddata", type="text", nullable=true, length=65535)
* @ORM\Column(name="carddata", type="text", nullable=true, length=16777215)
* The length corresponds to MEDIUMTEXT in MySQL
*/
private $cardData;

Expand Down
3 changes: 2 additions & 1 deletion src/Entity/SchedulingObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class SchedulingObject
private $principalUri;

/**
* @ORM\Column(name="calendardata", type="text", nullable=true, length=65535)
* @ORM\Column(name="calendardata", type="text", nullable=true, length=16777215)
* The length corresponds to MEDIUMTEXT in MySQL
*/
private $calendarData;

Expand Down

0 comments on commit f2e08c9

Please sign in to comment.