zend-blog-3-backend

Форк
0
/
Version20150223224004.php 
36 строк · 1.7 Кб
1
<?php
2

3
namespace Application\Migrations;
4

5
use Doctrine\DBAL\Schema\Schema;
6
use Doctrine\Migrations\AbstractMigration;
7

8
/**
9
 * Auto-generated Migration: Please modify to your needs!
10
 */
11
class Version20150223224004 extends AbstractMigration
12
{
13
    public function up(Schema $schema): void
14
    {
15
        // this up() migration is auto-generated, please modify it to your needs
16
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
17

18
        $this->addSql('DROP INDEX UNIQ_CDD78530C44967C5 ON tracking_agent');
19
        $this->addSql('ALTER TABLE tracking_agent ADD hash VARCHAR(32) NOT NULL AFTER user_agent, CHANGE user_agent user_agent TEXT NOT NULL');
20
        $this->addSql('UPDATE tracking_agent SET hash = MD5(user_agent)');
21
        $this->addSql('CREATE UNIQUE INDEX UNIQ_CDD78530D1B862B8 ON tracking_agent (hash)');
22
        $this->addSql('ALTER TABLE tracking ADD timestamp_created INT NOT NULL');
23
        $this->addSql('UPDATE tracking SET timestamp_created = UNIX_TIMESTAMP( time_created )');
24
    }
25

26
    public function down(Schema $schema): void
27
    {
28
        // this down() migration is auto-generated, please modify it to your needs
29
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
30

31
        $this->addSql('DROP INDEX UNIQ_CDD78530D1B862B8 ON tracking_agent');
32
        $this->addSql('ALTER TABLE tracking_agent DROP hash, CHANGE user_agent user_agent VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci');
33
        $this->addSql('CREATE UNIQUE INDEX UNIQ_CDD78530C44967C5 ON tracking_agent (user_agent)');
34
        $this->addSql('ALTER TABLE tracking DROP timestamp_created');
35
    }
36
}
37

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.