diff --git a/src/commands/schema/diff.ts b/src/commands/schema/diff.ts index 69736bfc..8bad3f0c 100644 --- a/src/commands/schema/diff.ts +++ b/src/commands/schema/diff.ts @@ -9,6 +9,10 @@ export default class DiffSchemaCommand extends SchemaCommand { description: "Compare the local schema to the active schema.", default: false, }), + text: Flags.boolean({ + description: "Display the text diff instead of the semantic diff.", + default: false, + }), }; static description = "Print the diff between local and remote schema."; @@ -57,6 +61,7 @@ export default class DiffSchemaCommand extends SchemaCommand { ...(hasColor() ? { color: colorParam() } : {}), staged: this.flags?.active ? "false" : "true", ...(version !== undefined ? { version } : { force: "true" }), + text_diff: this.flags?.text ? "true" : "false", }); const res = await fetch(new URL(`/schema/1/validate?${params}`, url), { method: "POST", @@ -85,7 +90,11 @@ export default class DiffSchemaCommand extends SchemaCommand { `Differences between the ${bold()}local${reset()} schema and the ${bold()}remote${reset()} schema:` ); } - this.log(json.diff ? json.diff : "No schema differences"); + if (this.flags?.text) { + this.log(json.text_diff ? json.text_diff : "No schema differences"); + } else { + this.log(json.diff ? json.diff : "No schema differences"); + } } catch (err) { this.error(err); }