<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20260603120000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add creator_push_notification table for in-app notification feed.';
}
public function up(Schema $schema): void
{
$this->addSql(
'CREATE TABLE creator_push_notification (
id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL,
creator_id BIGINT UNSIGNED NOT NULL,
type VARCHAR(50) NOT NULL,
title VARCHAR(255) DEFAULT NULL,
body TEXT DEFAULT NULL,
button_text VARCHAR(255) DEFAULT NULL,
button_link VARCHAR(512) DEFAULT NULL,
activity_id BIGINT UNSIGNED DEFAULT NULL,
campaign_id BIGINT UNSIGNED DEFAULT NULL,
payload JSON DEFAULT NULL,
created_at DATETIME NOT NULL,
INDEX idx_creator_created_at (creator_id, created_at),
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB',
);
$this->addSql(
'ALTER TABLE creator_push_notification ADD CONSTRAINT FK_creator_push_notification_creator FOREIGN KEY (creator_id) REFERENCES creator (id)',
);
$this->addSql(
'ALTER TABLE creator_push_notification ADD CONSTRAINT FK_creator_push_notification_activity FOREIGN KEY (activity_id) REFERENCES activity (id)',
);
$this->addSql(
'ALTER TABLE creator_push_notification ADD CONSTRAINT FK_creator_push_notification_campaign FOREIGN KEY (campaign_id) REFERENCES campaign (id)',
);
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE creator_push_notification DROP FOREIGN KEY FK_creator_push_notification_campaign');
$this->addSql('ALTER TABLE creator_push_notification DROP FOREIGN KEY FK_creator_push_notification_activity');
$this->addSql('ALTER TABLE creator_push_notification DROP FOREIGN KEY FK_creator_push_notification_creator');
$this->addSql('DROP TABLE creator_push_notification');
}
}