41 lines
3.1 KiB
PHP
41 lines
3.1 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 Version20230615214258 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 TEMPORARY TABLE __temp__comment AS SELECT id, body, created_at, updated_at, is_public, attachment_location, attachment_content_type, attachment_name, is_purchase, comment_type, attachment_size FROM comment');
|
|
$this->addSql('DROP TABLE comment');
|
|
$this->addSql('CREATE TABLE comment (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, ticket_id INTEGER NOT NULL, body CLOB NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, is_public BOOLEAN NOT NULL, attachment_location VARCHAR(255) DEFAULT NULL, attachment_content_type VARCHAR(255) DEFAULT NULL, attachment_name VARCHAR(255) DEFAULT NULL, is_purchase BOOLEAN NOT NULL, comment_type VARCHAR(255) NOT NULL, attachment_size INTEGER DEFAULT NULL, CONSTRAINT FK_9474526C700047D2 FOREIGN KEY (ticket_id) REFERENCES ticket (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
|
$this->addSql('INSERT INTO comment (id, body, created_at, updated_at, is_public, attachment_location, attachment_content_type, attachment_name, is_purchase, comment_type, attachment_size) SELECT id, body, created_at, updated_at, is_public, attachment_location, attachment_content_type, attachment_name, is_purchase, comment_type, attachment_size FROM __temp__comment');
|
|
$this->addSql('DROP TABLE __temp__comment');
|
|
$this->addSql('CREATE INDEX IDX_9474526C700047D2 ON comment (ticket_id)');
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
// this down() migration is auto-generated, please modify it to your needs
|
|
$this->addSql('CREATE TEMPORARY TABLE __temp__comment AS SELECT id, body, created_at, updated_at, is_public, attachment_location, attachment_content_type, attachment_name, is_purchase, comment_type, attachment_size FROM comment');
|
|
$this->addSql('DROP TABLE comment');
|
|
$this->addSql('CREATE TABLE comment (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, body CLOB NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, is_public BOOLEAN NOT NULL, attachment_location VARCHAR(255) DEFAULT NULL, attachment_content_type VARCHAR(255) DEFAULT NULL, attachment_name VARCHAR(255) DEFAULT NULL, is_purchase BOOLEAN NOT NULL, comment_type VARCHAR(255) NOT NULL, attachment_size INTEGER DEFAULT NULL)');
|
|
$this->addSql('INSERT INTO comment (id, body, created_at, updated_at, is_public, attachment_location, attachment_content_type, attachment_name, is_purchase, comment_type, attachment_size) SELECT id, body, created_at, updated_at, is_public, attachment_location, attachment_content_type, attachment_name, is_purchase, comment_type, attachment_size FROM __temp__comment');
|
|
$this->addSql('DROP TABLE __temp__comment');
|
|
}
|
|
}
|