intranet/migrations/Version20230615214617.php
Audrey Jensen 632199009d init
2023-06-28 15:38:14 +00:00

43 lines
3.7 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 Version20230615214617 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, ticket_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, created_by_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) ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_9474526CB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO comment (id, ticket_id, body, created_at, updated_at, is_public, attachment_location, attachment_content_type, attachment_name, is_purchase, comment_type, attachment_size) SELECT id, ticket_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)');
$this->addSql('CREATE INDEX IDX_9474526CB03A8386 ON comment (created_by_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, ticket_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, ticket_id, body, created_at, updated_at, is_public, attachment_location, attachment_content_type, attachment_name, is_purchase, comment_type, attachment_size) SELECT id, ticket_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)');
}
}