feat: add two- and four-weekly series and drop the weekday picker
This commit is contained in:
1 parent
8b88384d68
commit
faef4d70a8
10 files changed
+166
-103
No files matched your search
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20260914090000 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Drops booking_series.weekdays -- a series now strides from its start date';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// A recurrence rule is only a step size now (1, 7, 14 or 28 days), and every whole-week
|
||||
// stride holds the weekday of the start date by construction. The column had nothing
|
||||
// left to say. Existing rows need no data migration: their start_date already carries
|
||||
// the weekday, and the stride reproduces it.
|
||||
$this->addSql('ALTER TABLE booking_series DROP weekdays');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// Lossy on purpose, and not fixable: which weekdays a multi-day weekly series used to
|
||||
// run on is gone once the column is dropped. Every restored row comes back as "[]",
|
||||
// which the old code read as "every calendar day" for DAILY and "no days at all" for
|
||||
// WEEKLY -- so a rolled-back weekly series would materialise nothing.
|
||||
$this->addSql("ALTER TABLE booking_series ADD weekdays JSON NOT NULL DEFAULT '[]'");
|
||||
$this->addSql('ALTER TABLE booking_series ALTER weekdays DROP DEFAULT');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user