-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add membershipStatus to member revision
This way history is kept for changing memberships, which is interesting to view membership history over time. The event listener responsible for this was already implemented in: src/EventSubscriber/EasyAdminEventSubscriber.php as it simply called the constructor of the MemberDetailsRevision and passes a Membership as its argument. Therefore just adding the field, a migration and changing the constructor to add this makes this work.
- Loading branch information
Robin de Rooij
committed
Feb 24, 2024
1 parent
35cfe8f
commit f982851
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?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 Version20240224201202 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 admin_member_revision ADD current_membership_status_id INT DEFAULT NULL'); | ||
$this->addSql('ALTER TABLE admin_member_revision ADD CONSTRAINT FK_A66E5AC1E1F48A9F FOREIGN KEY (current_membership_status_id) REFERENCES admin_membershipstatus (id)'); | ||
$this->addSql('CREATE INDEX IDX_A66E5AC1E1F48A9F ON admin_member_revision (current_membership_status_id)'); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
// this down() migration is auto-generated, please modify it to your needs | ||
$this->addSql('ALTER TABLE admin_member_revision DROP FOREIGN KEY FK_A66E5AC1E1F48A9F'); | ||
$this->addSql('DROP INDEX IDX_A66E5AC1E1F48A9F ON admin_member_revision'); | ||
$this->addSql('ALTER TABLE admin_member_revision DROP current_membership_status_id'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters