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

Display schema and data for created and dropped tables in dolt diff command #3318

Merged
merged 5 commits into from Apr 28, 2022

Conversation

fulghum
Copy link
Contributor

@fulghum fulghum commented Apr 27, 2022

Fixes: #3300

The dolt diff command was previously omitting schema and data diffs if tables were created or dropped within the commit range, and only outputting diff summary information with tabular output. This change causes the schema changes and data changes to be included in tabular output.

Old behavior:

❯ dolt diff mhgva1kfcljign82ntcmr6ftmpbmemko j6n5727at9652tri8ncsa02v794h1fi4
diff --dolt a/a b/a
added table

❯ dolt diff mhgva1kfcljign82ntcmr6ftmpbmemko ccm9bfiv6jhft1tmeu1cqd0ghduhg4v7
diff --dolt a/a b/a
added table

❯ dolt diff qd507o2jjlckjgmn2polsmiifk62vo8n js1bb2cvdr7h4tdj2d3m33jhp9rc9ee9
diff --dolt a/a b/a
deleted table

New behavior:

❯ dolt diff mhgva1kfcljign82ntcmr6ftmpbmemko j6n5727at9652tri8ncsa02v794h1fi4
diff --dolt a/a b/a
added table
+CREATE TABLE `a` (
+  `n` int NOT NULL,
+  PRIMARY KEY (`n`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+-----+---+
|     | n |
+-----+---+
+-----+---+

❯ dolt diff mhgva1kfcljign82ntcmr6ftmpbmemko ccm9bfiv6jhft1tmeu1cqd0ghduhg4v7
diff --dolt a/a b/a
added table
+CREATE TABLE `a` (
+  `n` int NOT NULL,
+  PRIMARY KEY (`n`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+-----+---+
|     | n |
+-----+---+
|  +  | 1 |
|  +  | 2 |
+-----+---+

❯ dolt diff qd507o2jjlckjgmn2polsmiifk62vo8n js1bb2cvdr7h4tdj2d3m33jhp9rc9ee9
diff --dolt a/a b/a
deleted table
-CREATE TABLE `a` (
-  `n` int NOT NULL,
-  PRIMARY KEY (`n`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+-----+---+
|     | n |
+-----+---+
|  -  | 1 |
|  -  | 2 |
|  -  | 3 |
+-----+---+

…elete tables, and to include data in diff when adding or dropping a table.
…des created or dropped tables shows a summary of changes, schema changes, and data changes.
@fulghum fulghum requested a review from zachmu April 28, 2022 01:08
Copy link
Member

@zachmu zachmu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a couple small comments

go/cmd/dolt/commands/diff.go Show resolved Hide resolved
go/libraries/doltcore/sqle/tables.go Outdated Show resolved Hide resolved
@fulghum fulghum merged commit af8728b into main Apr 28, 2022
@Hydrocharged Hydrocharged deleted the fulghum/diff-command branch October 13, 2022 12:41
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

Successfully merging this pull request may close these issues.

dolt diff doesn't show data diff when table was added within the commit range
2 participants