php-mysql-diff icon indicating copy to clipboard operation
php-mysql-diff copied to clipboard

Changing only table comments does not work.

Open novaoki opened this issue 8 years ago • 4 comments

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.

novaoki avatar Mar 18 '17 14:03 novaoki

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?

camcima avatar Nov 02 '17 04:11 camcima

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.

novaoki avatar Nov 07 '17 02:11 novaoki

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.

novaoki avatar Dec 10 '17 04:12 novaoki

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.

kentasaito avatar Mar 05 '18 10:03 kentasaito