reset to setup module state
Remove Task Manager implementation to match `# Setup module` in module.md. Backend src/ reduced to Kernel.php + empty Entity/, all migrations deleted, database dropped and recreated. Frontend components/views/services/stores removed, App.vue/router/style.css reduced to skeletons. CLAUDE.md shortened to Setup-stand. Old backend/plan.md, plan2.md removed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20260323230657 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE category (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, color VARCHAR(7) NOT NULL, PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('CREATE TABLE task (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, status VARCHAR(20) NOT NULL, task_type VARCHAR(20) NOT NULL, deadline DATE DEFAULT NULL, interval_type VARCHAR(20) DEFAULT NULL, start_date DATE DEFAULT NULL, end_date DATE DEFAULT NULL, weekdays JSON DEFAULT NULL, month_days JSON DEFAULT NULL, category_id INT DEFAULT NULL, INDEX IDX_527EDB2512469DE2 (category_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('ALTER TABLE task ADD CONSTRAINT FK_527EDB2512469DE2 FOREIGN KEY (category_id) REFERENCES category (id) ON DELETE SET NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE task DROP FOREIGN KEY FK_527EDB2512469DE2');
|
||||
$this->addSql('DROP TABLE category');
|
||||
$this->addSql('DROP TABLE task');
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20260324141105 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE task_completion (id INT AUTO_INCREMENT NOT NULL, date DATE NOT NULL, task_id INT NOT NULL, INDEX IDX_24C57CD18DB60186 (task_id), UNIQUE INDEX UNIQ_24C57CD18DB60186AA9E377A (task_id, date), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('ALTER TABLE task_completion ADD CONSTRAINT FK_24C57CD18DB60186 FOREIGN KEY (task_id) REFERENCES task (id) ON DELETE CASCADE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE task_completion DROP FOREIGN KEY FK_24C57CD18DB60186');
|
||||
$this->addSql('DROP TABLE task_completion');
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20260324154816 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE task_occurrence (id INT AUTO_INCREMENT NOT NULL, date DATE NOT NULL, status VARCHAR(20) NOT NULL, task_id INT NOT NULL, INDEX IDX_A2EECA5C8DB60186 (task_id), UNIQUE INDEX UNIQ_A2EECA5C8DB60186AA9E377A (task_id, date), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('ALTER TABLE task_occurrence ADD CONSTRAINT FK_A2EECA5C8DB60186 FOREIGN KEY (task_id) REFERENCES task (id) ON DELETE CASCADE');
|
||||
$this->addSql("INSERT INTO task_occurrence (task_id, date, status) SELECT task_id, date, 'erledigt' FROM task_completion");
|
||||
$this->addSql('ALTER TABLE task_completion DROP FOREIGN KEY FK_24C57CD18DB60186');
|
||||
$this->addSql('DROP TABLE task_completion');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE task_occurrence DROP FOREIGN KEY FK_A2EECA5C8DB60186');
|
||||
$this->addSql('DROP TABLE task_occurrence');
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20260325064344 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE task_occurrence ADD name VARCHAR(255) DEFAULT NULL, ADD category_overridden TINYINT NOT NULL, ADD category_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE task_occurrence ADD CONSTRAINT FK_A2EECA5C12469DE2 FOREIGN KEY (category_id) REFERENCES category (id) ON DELETE SET NULL');
|
||||
$this->addSql('CREATE INDEX IDX_A2EECA5C12469DE2 ON task_occurrence (category_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE task_occurrence DROP FOREIGN KEY FK_A2EECA5C12469DE2');
|
||||
$this->addSql('DROP INDEX IDX_A2EECA5C12469DE2 ON task_occurrence');
|
||||
$this->addSql('ALTER TABLE task_occurrence DROP name, DROP category_overridden, DROP category_id');
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20260326165702 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Rename task → task_schema, task_occurrence → task';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// 1. Drop FKs on task_occurrence that reference task
|
||||
$this->addSql('ALTER TABLE task_occurrence DROP FOREIGN KEY FK_A2EECA5C8DB60186');
|
||||
|
||||
// 2. Drop FK on task.category_id
|
||||
$this->addSql('ALTER TABLE task DROP FOREIGN KEY FK_527EDB2512469DE2');
|
||||
|
||||
// 3. Rename tables
|
||||
$this->addSql('RENAME TABLE task TO task_schema');
|
||||
$this->addSql('RENAME TABLE task_occurrence TO task');
|
||||
|
||||
// 4. Re-create FK: task.task_id → task_schema.id
|
||||
$this->addSql('ALTER TABLE task ADD CONSTRAINT FK_527EDB258DB60186 FOREIGN KEY (task_id) REFERENCES task_schema (id) ON DELETE CASCADE');
|
||||
|
||||
// 5. Re-create FK: task_schema.category_id → category.id
|
||||
$this->addSql('ALTER TABLE task_schema ADD CONSTRAINT FK_8327C58112469DE2 FOREIGN KEY (category_id) REFERENCES category (id) ON DELETE SET NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// Drop FKs
|
||||
$this->addSql('ALTER TABLE task DROP FOREIGN KEY FK_527EDB258DB60186');
|
||||
$this->addSql('ALTER TABLE task_schema DROP FOREIGN KEY FK_8327C58112469DE2');
|
||||
|
||||
// Rename back
|
||||
$this->addSql('RENAME TABLE task TO task_occurrence');
|
||||
$this->addSql('RENAME TABLE task_schema TO task');
|
||||
|
||||
// Re-create original FKs
|
||||
$this->addSql('ALTER TABLE task_occurrence ADD CONSTRAINT FK_A2EECA5C8DB60186 FOREIGN KEY (task_id) REFERENCES task (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE task ADD CONSTRAINT FK_527EDB2512469DE2 FOREIGN KEY (category_id) REFERENCES category (id) ON DELETE SET NULL');
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20260330210659 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE task ADD created_at DATETIME NOT NULL, CHANGE date date DATE DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE task RENAME INDEX idx_a2eeca5c8db60186 TO IDX_527EDB258DB60186');
|
||||
$this->addSql('ALTER TABLE task RENAME INDEX idx_a2eeca5c12469de2 TO IDX_527EDB2512469DE2');
|
||||
$this->addSql('ALTER TABLE task RENAME INDEX uniq_a2eeca5c8db60186aa9e377a TO UNIQ_527EDB258DB60186AA9E377A');
|
||||
$this->addSql('ALTER TABLE task_schema ADD year_days JSON DEFAULT NULL, ADD created_at DATETIME NOT NULL, DROP interval_type');
|
||||
$this->addSql('ALTER TABLE task_schema RENAME INDEX idx_527edb2512469de2 TO IDX_8327C58112469DE2');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE task DROP created_at, CHANGE date date DATE NOT NULL');
|
||||
$this->addSql('ALTER TABLE task RENAME INDEX idx_527edb258db60186 TO IDX_A2EECA5C8DB60186');
|
||||
$this->addSql('ALTER TABLE task RENAME INDEX idx_527edb2512469de2 TO IDX_A2EECA5C12469DE2');
|
||||
$this->addSql('ALTER TABLE task RENAME INDEX uniq_527edb258db60186aa9e377a TO UNIQ_A2EECA5C8DB60186AA9E377A');
|
||||
$this->addSql('ALTER TABLE task_schema ADD interval_type VARCHAR(20) DEFAULT NULL, DROP year_days, DROP created_at');
|
||||
$this->addSql('ALTER TABLE task_schema RENAME INDEX idx_8327c58112469de2 TO IDX_527EDB2512469DE2');
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20260331120000 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Remove categoryOverridden: backfill task.category_id from schema, then drop column';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('UPDATE task t INNER JOIN task_schema ts ON t.task_id = ts.id SET t.category_id = ts.category_id WHERE t.category_overridden = 0');
|
||||
$this->addSql('ALTER TABLE task DROP category_overridden');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE task ADD category_overridden TINYINT(1) NOT NULL DEFAULT 0');
|
||||
}
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20260331150000 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Major refactoring: English enums, unified days field, nullable task.schema, detach single tasks';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// 1. Migrate enum values to English
|
||||
$this->addSql("UPDATE task SET status = 'active' WHERE status = 'aktiv'");
|
||||
$this->addSql("UPDATE task SET status = 'done' WHERE status = 'erledigt'");
|
||||
|
||||
$this->addSql("UPDATE task_schema SET status = 'active' WHERE status = 'aktiv'");
|
||||
$this->addSql("UPDATE task_schema SET status = 'disabled' WHERE status IN ('erledigt', 'inaktiv')");
|
||||
|
||||
$this->addSql("UPDATE task_schema SET task_type = 'single' WHERE task_type = 'einzel'");
|
||||
$this->addSql("UPDATE task_schema SET task_type = 'daily' WHERE task_type = 'taeglich'");
|
||||
$this->addSql("UPDATE task_schema SET task_type = 'custom' WHERE task_type IN ('multi', 'woechentlich', 'monatlich', 'jaehrlich')");
|
||||
|
||||
// 2. Add unified days column
|
||||
$this->addSql('ALTER TABLE task_schema ADD days JSON DEFAULT NULL');
|
||||
|
||||
// 3. Migrate weekdays/monthDays/yearDays into days JSON via PHP
|
||||
$this->migrateDaysData();
|
||||
|
||||
// 4. Drop old columns from task_schema
|
||||
$this->addSql('ALTER TABLE task_schema DROP deadline, DROP weekdays, DROP month_days, DROP year_days');
|
||||
|
||||
// 5. Backfill task names/categories from schema (for all tasks that relied on getEffectiveName fallback)
|
||||
$this->addSql("UPDATE task t INNER JOIN task_schema ts ON t.task_id = ts.id SET t.name = ts.name WHERE t.name IS NULL");
|
||||
$this->addSql("UPDATE task t INNER JOIN task_schema ts ON t.task_id = ts.id SET t.category_id = ts.category_id WHERE t.category_id IS NULL AND ts.category_id IS NOT NULL");
|
||||
|
||||
// 6. Detach single tasks
|
||||
$this->addSql("UPDATE task t INNER JOIN task_schema ts ON t.task_id = ts.id SET t.name = ts.name WHERE ts.task_type = 'single' AND t.name IS NULL");
|
||||
$this->addSql("UPDATE task t INNER JOIN task_schema ts ON t.task_id = ts.id SET t.category_id = ts.category_id WHERE ts.task_type = 'single' AND t.category_id IS NULL");
|
||||
|
||||
// Drop FK + unique constraint before modifying task_id
|
||||
$this->addSql('ALTER TABLE task DROP FOREIGN KEY FK_527EDB258DB60186');
|
||||
$this->addSql('DROP INDEX UNIQ_527EDB258DB60186AA9E377A ON task');
|
||||
|
||||
// Detach single tasks
|
||||
$this->addSql("UPDATE task t INNER JOIN task_schema ts ON t.task_id = ts.id SET t.task_id = NULL WHERE ts.task_type = 'single'");
|
||||
|
||||
// Delete single schemas
|
||||
$this->addSql("DELETE FROM task_schema WHERE task_type = 'single'");
|
||||
|
||||
// Make task_id nullable with SET NULL on delete
|
||||
$this->addSql('ALTER TABLE task MODIFY task_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE task ADD CONSTRAINT FK_527EDB258DB60186 FOREIGN KEY (task_id) REFERENCES task_schema (id) ON DELETE SET NULL');
|
||||
}
|
||||
|
||||
private function migrateDaysData(): void
|
||||
{
|
||||
$rows = $this->connection->fetchAllAssociative(
|
||||
'SELECT id, weekdays, month_days, year_days FROM task_schema'
|
||||
);
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$days = [];
|
||||
|
||||
$weekdays = $row['weekdays'] ? json_decode($row['weekdays'], true) : null;
|
||||
$monthDays = $row['month_days'] ? json_decode($row['month_days'], true) : null;
|
||||
$yearDays = $row['year_days'] ? json_decode($row['year_days'], true) : null;
|
||||
|
||||
if (!empty($weekdays)) {
|
||||
$days['week'] = $weekdays;
|
||||
}
|
||||
if (!empty($monthDays)) {
|
||||
$days['month'] = $monthDays;
|
||||
}
|
||||
if (!empty($yearDays)) {
|
||||
$days['year'] = $yearDays;
|
||||
}
|
||||
|
||||
if (!empty($days)) {
|
||||
$this->connection->executeStatement(
|
||||
'UPDATE task_schema SET days = ? WHERE id = ?',
|
||||
[json_encode($days), $row['id']]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE task_schema ADD deadline DATE DEFAULT NULL, ADD weekdays JSON DEFAULT NULL, ADD month_days JSON DEFAULT NULL, ADD year_days JSON DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE task_schema DROP days');
|
||||
|
||||
$this->addSql('ALTER TABLE task DROP FOREIGN KEY FK_527EDB258DB60186');
|
||||
$this->addSql('ALTER TABLE task MODIFY task_id INT NOT NULL');
|
||||
$this->addSql('ALTER TABLE task ADD CONSTRAINT FK_527EDB258DB60186 FOREIGN KEY (task_id) REFERENCES task_schema (id) ON DELETE CASCADE');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_527EDB258DB60186AA9E377A ON task (task_id, date)');
|
||||
|
||||
$this->addSql("UPDATE task SET status = 'aktiv' WHERE status = 'active'");
|
||||
$this->addSql("UPDATE task SET status = 'erledigt' WHERE status = 'done'");
|
||||
$this->addSql("UPDATE task_schema SET status = 'aktiv' WHERE status = 'active'");
|
||||
$this->addSql("UPDATE task_schema SET status = 'inaktiv' WHERE status = 'disabled'");
|
||||
$this->addSql("UPDATE task_schema SET task_type = 'einzel' WHERE task_type = 'single'");
|
||||
$this->addSql("UPDATE task_schema SET task_type = 'taeglich' WHERE task_type = 'daily'");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user