<?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 Version20261120092339 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 ManualTransfer (id INT NOT NULL, name VARCHAR(255) NOT NULL, sourceId INT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE ProviderPayment (id INT AUTO_INCREMENT NOT NULL, provider_id INT NOT NULL, user_id INT NOT NULL, date DATETIME NOT NULL, amount DOUBLE PRECISION NOT NULL, description VARCHAR(255) DEFAULT NULL, active TINYINT(1) NOT NULL, INDEX IDX_8452871CA53A8AA (provider_id), INDEX IDX_8452871CA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE mobile_notification (id VARCHAR(36) NOT NULL, user_id INT NOT NULL, type VARCHAR(40) NOT NULL, category VARCHAR(8) NOT NULL, params JSON NOT NULL, order_reference VARCHAR(64) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', read_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', deleted_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', push_status VARCHAR(8) NOT NULL, push_tickets JSON DEFAULT NULL, pushed_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_3136B466A76ED395 (user_id), INDEX idx_mobile_notification_user (user_id, deleted_at, created_at), INDEX idx_mobile_notification_push (push_status, created_at), INDEX idx_mobile_notification_dedupe (user_id, type, order_reference), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE mobile_notification_prefs (user_id INT NOT NULL, bookings TINYINT(1) DEFAULT 1 NOT NULL, reminders TINYINT(1) DEFAULT 1 NOT NULL, offers TINYINT(1) DEFAULT 1 NOT NULL, email TINYINT(1) DEFAULT 0 NOT NULL, updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', PRIMARY KEY(user_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE mobile_session (id VARCHAR(36) NOT NULL, user_id INT NOT NULL, device_id VARCHAR(64) NOT NULL, device_name VARCHAR(120) DEFAULT NULL, platform VARCHAR(16) DEFAULT NULL, app_version VARCHAR(32) DEFAULT NULL, refresh_hash VARCHAR(64) NOT NULL, previous_hash VARCHAR(64) DEFAULT NULL, rotated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', auth_method VARCHAR(16) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', last_used_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', expires_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', revoked_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', revoke_reason VARCHAR(32) DEFAULT NULL, last_ip VARCHAR(45) DEFAULT NULL, push_token VARCHAR(255) DEFAULT NULL, push_token_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', locale VARCHAR(5) DEFAULT NULL, INDEX IDX_30EE1821A76ED395 (user_id), INDEX idx_mobile_session_previous_hash (previous_hash), INDEX idx_mobile_session_user_device (user_id, device_id), INDEX idx_mobile_session_expires_at (expires_at), INDEX idx_mobile_session_push_token (push_token), UNIQUE INDEX uniq_mobile_session_refresh_hash (refresh_hash), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE ManualTransfer ADD CONSTRAINT FK_E299BF10BF396750 FOREIGN KEY (id) REFERENCES Product (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE ProviderPayment ADD CONSTRAINT FK_8452871CA53A8AA FOREIGN KEY (provider_id) REFERENCES Provider (id)');
$this->addSql('ALTER TABLE ProviderPayment ADD CONSTRAINT FK_8452871CA76ED395 FOREIGN KEY (user_id) REFERENCES User (id)');
$this->addSql('ALTER TABLE mobile_notification ADD CONSTRAINT FK_3136B466A76ED395 FOREIGN KEY (user_id) REFERENCES User (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE mobile_notification_prefs ADD CONSTRAINT FK_B4A1C7CA76ED395 FOREIGN KEY (user_id) REFERENCES User (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE mobile_session ADD CONSTRAINT FK_30EE1821A76ED395 FOREIGN KEY (user_id) REFERENCES User (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE OrderLine ADD imported TINYINT(1) DEFAULT 0 NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE ManualTransfer DROP FOREIGN KEY FK_E299BF10BF396750');
$this->addSql('ALTER TABLE ProviderPayment DROP FOREIGN KEY FK_8452871CA53A8AA');
$this->addSql('ALTER TABLE ProviderPayment DROP FOREIGN KEY FK_8452871CA76ED395');
$this->addSql('ALTER TABLE mobile_notification DROP FOREIGN KEY FK_3136B466A76ED395');
$this->addSql('ALTER TABLE mobile_notification_prefs DROP FOREIGN KEY FK_B4A1C7CA76ED395');
$this->addSql('ALTER TABLE mobile_session DROP FOREIGN KEY FK_30EE1821A76ED395');
$this->addSql('DROP TABLE ManualTransfer');
$this->addSql('DROP TABLE ProviderPayment');
$this->addSql('DROP TABLE mobile_notification');
$this->addSql('DROP TABLE mobile_notification_prefs');
$this->addSql('DROP TABLE mobile_session');
$this->addSql('ALTER TABLE OrderLine DROP imported');
}
}