Files
socialhose-php/app/DoctrineMigrations/Version20170623141928.php
T
2022-12-09 08:36:26 -06:00

39 lines
1.3 KiB
PHP

<?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20170623141928 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE comments ADD new TINYINT(1) NOT NULL');
$this->addSql('DELETE FROM comments');
$this->addSql('ALTER TABLE documents ADD comments_count INT NOT NULL');
$this->addSql('UPDATE documents SET comments_count = 0');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE comments DROP new');
$this->addSql('ALTER TABLE documents DROP comments_count');
}
}