add diff mode (#614)

* initial diff viewer

* test

* test

* name change

* new table show

* diff viewer
This commit is contained in:
Guy Ben-Aharon
2025-03-13 11:12:11 +02:00
committed by GitHub
parent bd67ccfbcf
commit 52d2ea596c
14 changed files with 1276 additions and 46 deletions

View File

@@ -115,8 +115,22 @@ export const exportBaseSQL = (diagram: Diagram): string => {
// Remove the type cast part after :: if it exists
if (fieldDefault.includes('::')) {
const endedWithParentheses = fieldDefault.endsWith(')');
fieldDefault = fieldDefault.split('::')[0];
if (
(fieldDefault.startsWith('(') &&
!fieldDefault.endsWith(')')) ||
endedWithParentheses
) {
fieldDefault += ')';
}
}
if (fieldDefault === `('now')`) {
fieldDefault = `now()`;
}
sqlScript += ` DEFAULT ${fieldDefault}`;
}