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

Do not change diff when change schema column byte value #61

Closed
nipe0324 opened this issue Jul 15, 2020 · 1 comment
Closed

Do not change diff when change schema column byte value #61

nipe0324 opened this issue Jul 15, 2020 · 1 comment

Comments

@nipe0324
Copy link

Step to reproduce

My environment:

  • MySQL Server version: 5.7.29 Homebrew
  • mysqldef v0.5.14

Step1. Create database

CREATE DATABASE IF NOT EXISTS `test01` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;

Step2. Initialize table

CREATE TABLE `items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

Step3. Write schema.sql file.

CREATE TABLE `items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(1000) COLLATE utf8mb4_bin DEFAULT NULL, -- change varchar 255 to 1000
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

Step4. Do mysqldef as dry-run, but show Nothing is modified.

$ ./mysqldef -uroot --file=schema.sql --dry-run test01
-- Nothing is modified --

I guess that sqldef should show alter table as below.

ALTER TABLE items MODIFY `name` varchar(1000) COLLATE utf8mb4_bin DEFAULT NULL
@k0kubun
Copy link
Collaborator

k0kubun commented Jul 16, 2020

Fixed the issue and started its release at v0.6.3.

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