Part-DB.Part-DB-server/src/Migrations/Version20200502161750.php

39 lines
2.1 KiB
PHP
Raw Normal View History

<?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 Version20200502161750 extends AbstractMigration
{
2020-05-10 21:39:31 +02:00
public function getDescription(): string
{
return '';
}
2020-05-10 21:39:31 +02:00
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
2020-05-10 21:39:31 +02:00
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE label_profiles (id INT AUTO_INCREMENT NOT NULL, id_preview_attachement INT DEFAULT NULL, comment LONGTEXT NOT NULL, show_in_dropdown TINYINT(1) NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, options_width DOUBLE PRECISION NOT NULL, options_height DOUBLE PRECISION NOT NULL, options_barcode_type VARCHAR(255) NOT NULL, options_picture_type VARCHAR(255) NOT NULL, options_supported_element VARCHAR(255) NOT NULL, options_additional_css LONGTEXT NOT NULL, options_lines_mode VARCHAR(255) NOT NULL, options_lines LONGTEXT NOT NULL, INDEX IDX_C93E9CF56DEDCEC2 (id_preview_attachement), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE label_profiles ADD CONSTRAINT FK_C93E9CF56DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES `attachments` (id)');
$this->addSql('ALTER TABLE log CHANGE level level TINYINT(4) NOT NULL');
}
2020-05-10 21:39:31 +02:00
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
2020-05-10 21:39:31 +02:00
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('DROP TABLE label_profiles');
$this->addSql('ALTER TABLE log CHANGE level level TINYINT(1) DEFAULT NULL');
}
}