fix: dbml export default time bug (#922)

This commit is contained in:
Guy Ben-Aharon
2025-09-17 15:08:44 +03:00
committed by GitHub
parent 26dc299cd2
commit bc82f9d6a8
4 changed files with 45 additions and 51 deletions

View File

@@ -381,6 +381,16 @@ export const exportBaseSQL = ({
fieldDefault = `now()`;
}
// Fix CURRENT_DATE() for PostgreSQL in DBML flow - PostgreSQL uses CURRENT_DATE without parentheses
if (
isDBMLFlow &&
targetDatabaseType === DatabaseType.POSTGRESQL
) {
if (fieldDefault.toUpperCase() === 'CURRENT_DATE()') {
fieldDefault = 'CURRENT_DATE';
}
}
sqlScript += ` DEFAULT ${fieldDefault}`;
}
}