camcima / php-mysql-diff

MySQL Schema Diff - Comparison / Migration Script Generation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Changing only table comments does not work.

novaoki opened this issue · comments

commented

Hi.

Changing only table comments does not work.
The alter statement is output, but there is no value.

Execution result.

ALTER TABLE target_table
;

Is not it supposed to change table comments?

Thank you.

Hi @novaoki , I've included a new test with PR #19 that shows that changing only the comment will create the correct ALTER TABLE script. Can you please post an example where it doesn't work?

commented

Hi @camcima.
Thank you for your reply.
A little time has passed, so memory is vague.
I will verify it so please take some time.

commented

Hi @camcima.
I'm sorry that it takes time to verify.
"php -mysql-diff migrate" correctly output alter statements.

However, the content was not displayed in "php -mysql-diff diff".

► table "assign" has a different schema

Diff completed!

Verified in sql below.
a.sql

CREATE TABLE IF NOT EXISTS assign (
user_id BIGINT UNSIGNED NOT NULL COMMENT 'ユーザID',
update_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最終更新日時',
create_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '登録日時',
PRIMARY KEY user_id)
ENGINE = InnoDB
COMMENT = 'アサイン情報1';

b.sql

CREATE TABLE IF NOT EXISTS assign (
user_id BIGINT UNSIGNED NOT NULL COMMENT 'ユーザID',
update_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最終更新日時',
create_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '登録日時',
PRIMARY KEY user_id)
ENGINE = InnoDB
COMMENT = 'アサイン情報';

Thanks.

Hi.

I met similar case on PHP MySQL Diff 1.2.1 (installed from composer).

from.schema

CREATE TABLE admin (
admin_id int(11) COMMENT 'Administrator ID'
);

to.schema

CREATE TABLE admin (
admin_id int(11) COMMENT 'タ'
);

When column comment included some non-ascii charactor, the command returns like below:

FROM from.schema
TO to.schema

▼ table "admin" is in the FROM database but not in the TO database

I guess it happens with charactor has 3rd byte(UTF-8) as 0xbf (i.e. 'タ'[E382BF] or 'み'[E381BF], etc).
I wonder, preg_match 'u'(PCRE_UTF8) pattern modifier fix this, but I'm not sure.