Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to MEDIUMTEXT for card and calendar data #127

Merged
merged 1 commit into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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