Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migration failed for MSSQL on alter_audit_mail #216

Closed
williamyiu opened this issue Aug 26, 2017 · 1 comment
Closed

migration failed for MSSQL on alter_audit_mail #216

williamyiu opened this issue Aug 26, 2017 · 1 comment

Comments

@williamyiu
Copy link

williamyiu commented Aug 26, 2017

SQL Server does not have type BYTEA. You should use VARBINARY(MAX)

<?php

use bedezign\yii2\audit\components\Migration;
use yii\db\Schema;

class m170126_000001_alter_audit_mail extends Migration
{
    const TABLE = '{{%audit_mail}}';

    public function up()
    {
        if ($this->db->driverName === 'mysql') {
            $this->alterColumn(self::TABLE, 'data', 'LONGBLOB');
        } elseif ($this->db->driverName === 'sqlsrv') {
            $this->alterColumn(self::TABLE, 'data', 'VARBINARY(MAX)');
        } else {
            $this->alterColumn(self::TABLE, 'data', 'BYTEA');
        }
    }
}
@Blizzke
Copy link
Member

Blizzke commented Aug 27, 2017

Argh. I overlooked this when I drafted the new release or it would've been included already.
Sorry about that.
In any case, your fix was added via commit 0313f34

@Blizzke Blizzke closed this as completed Aug 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants