<?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 Version20240508151423 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 school_class_client (id INT AUTO_INCREMENT NOT NULL, school_class_id INT DEFAULT NULL, client_id VARCHAR(50) NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_C32AF35314463F54 (school_class_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE visit_count (id INT AUTO_INCREMENT NOT NULL, visit_type_id INT DEFAULT NULL, school_class_client_id INT DEFAULT NULL, item_id VARCHAR(50) NOT NULL, num_visits INT NOT NULL, update_at DATETIME NOT NULL, INDEX IDX_F06CBF0393C58854 (visit_type_id), INDEX IDX_F06CBF03EC912EB2 (school_class_client_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE visit_type (id INT AUTO_INCREMENT NOT NULL, type_name VARCHAR(191) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE school_class_client ADD CONSTRAINT FK_C32AF35314463F54 FOREIGN KEY (school_class_id) REFERENCES school_class (id)');
$this->addSql('ALTER TABLE visit_count ADD CONSTRAINT FK_F06CBF0393C58854 FOREIGN KEY (visit_type_id) REFERENCES visit_type (id)');
$this->addSql('ALTER TABLE visit_count ADD CONSTRAINT FK_F06CBF03EC912EB2 FOREIGN KEY (school_class_client_id) REFERENCES school_class_client (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE school_class_client DROP FOREIGN KEY FK_C32AF35314463F54');
$this->addSql('ALTER TABLE visit_count DROP FOREIGN KEY FK_F06CBF0393C58854');
$this->addSql('ALTER TABLE visit_count DROP FOREIGN KEY FK_F06CBF03EC912EB2');
$this->addSql('DROP TABLE school_class_client');
$this->addSql('DROP TABLE visit_count');
$this->addSql('DROP TABLE visit_type');
}
}