Files
crowd-fund-api/migrations/Version20260813171902.php
daniel.subiabre 1c678f113f
PHPUnit / phpunit (push) Canceled after 0s
chore: sync main to develop (#245)
* fix: upgrade goteo/benzina to 0.6

* feat: increase Nominatim cache TTL

* fix: allow long addresses for territory data

* fix: build project addresses from goteo 3 territory fields

* fix: handle empty strings for video sources

* fix: update project drafts deadline to 2026

* feat: split project description into 4 fields

* feat: bump doctrine related dependencies

* feat: bump symfony related dependencies

* feat: make categories work on idOrSlug

* fix: allow filtering on project descBrief property

* fix: update constraints on project update to allow optional updates of properties

* fix: update Projects test suite to new project shape

* fix: order of DROP operations in migration Version20260813171902

* fix: move accounting balance and checkout to supports listeners to onFlush events

* fix: bad order of filter safeguards

* chore: code style by php-cs-fixer

* fix: prevent uninitialized fields on api resource from breaking AccountingVoter

* fix: small bug preventing code improvements on Accounting api resource

* feat: add cover property on ProjectReward resource

* feat: add cover property to Project resources

* feat: use video cover for project cover

* feat: add migration for property cover on project and rewards

* fix: small improvements on UserOwned helpers

* feat: add territory to project creation

* feat: mark creation fields as required

* feat: add CollaborationCandidacy resource

* fix: update old validations access of new types

* feat: add validation for charges targetting projects not in campaign

* feat: validate new collaboration candicacies are to open collaborations

* feat: prevent future object access issues in SameProjectRewardChargeValidator

* fix: return void on succesfull delete operations

* fix: force set of isFinite property

* feat: allow to filter ProjectBudgetItem by type and deadline

* feat: remove example values from .env

* feat: add testing encryption keys

* feat: make project in BudgetItem body required

* feat: add testing encryption keys to actions

* feat: add collaborations property to ProjectApiResource
2026-09-18 10:44:12 +02:00

40 lines
2.5 KiB
PHP

<?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 Version20260813171902 extends AbstractMigration
{
public function getDescription(): string
{
return 'Update categories to work with INT ids and VARCHAR slugs';
}
public function up(Schema $schema): void
{
$this->addSql('DROP TABLE IF EXISTS project_category');
$this->addSql('DROP TABLE IF EXISTS category');
$this->addSql('CREATE TABLE category (id INT AUTO_INCREMENT NOT NULL, slug VARCHAR(56) NOT NULL, name VARCHAR(255) NOT NULL, locales JSON NOT NULL COMMENT \'(DC2Type:json)\', UNIQUE INDEX UNIQ_64C19C1989D9B62 (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE project_category (project_id INT NOT NULL, category_id INT NOT NULL, INDEX IDX_3B02921A166D1F9C (project_id), INDEX IDX_3B02921A12469DE2 (category_id), PRIMARY KEY(project_id, category_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE project_category ADD CONSTRAINT FK_3B02921A166D1F9C FOREIGN KEY (project_id) REFERENCES project (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE project_category ADD CONSTRAINT FK_3B02921A12469DE2 FOREIGN KEY (category_id) REFERENCES category (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE IF EXISTS project_category');
$this->addSql('DROP TABLE IF EXISTS category');
$this->addSql('CREATE TABLE category (id VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, locales JSON NOT NULL COMMENT \'(DC2Type:json)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE project_category (project_id INT NOT NULL, category_id VARCHAR(255) NOT NULL, INDEX IDX_3B02921A166D1F9C (project_id), INDEX IDX_3B02921A12469DE2 (category_id), PRIMARY KEY(project_id, category_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE project_category ADD CONSTRAINT FK_3B02921A166D1F9C FOREIGN KEY (project_id) REFERENCES project (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE project_category ADD CONSTRAINT FK_3B02921A12469DE2 FOREIGN KEY (category_id) REFERENCES category (id) ON DELETE CASCADE');
}
}