@@ -40,14 +40,6 @@ function columnDefault(field, database) {
4040 return `default: ${ parseDefaultDbml ( field , database ) } ` ;
4141}
4242
43- function columnComment ( field ) {
44- if ( ! field . comment || field . comment . trim ( ) === "" ) {
45- return "" ;
46- }
47-
48- return `note: '${ escapeQuotes ( field . comment ) } '` ;
49- }
50-
5143function columnSettings ( field , database ) {
5244 let constraints = [ ] ;
5345
@@ -98,6 +90,23 @@ function processComment(comment) {
9890 return `'${ escapeQuotes ( comment ) } '` ;
9991}
10092
93+ function columnComment ( field ) {
94+ if ( ! field . comment || field . comment . trim ( ) === "" ) {
95+ return "" ;
96+ }
97+
98+ return `note: ${ processComment ( field . comment ) } ` ;
99+ }
100+
101+ function processType ( type ) {
102+ // TODO: remove after a while
103+ if ( type . toUpperCase ( ) === "TIMESTAMP WITH TIME ZONE" ) {
104+ return "timestamptz" ;
105+ }
106+
107+ return type . toLowerCase ( ) ;
108+ }
109+
101110export function toDBML ( diagram ) {
102111 const generateRelString = ( rel ) => {
103112 const { fields : startTableFields , name : startTableName } =
@@ -142,7 +151,7 @@ export function toDBML(diagram) {
142151 `\t${ quoteIdentifier ( field . name ) } ${
143152 field . type === "ENUM" || field . type === "SET"
144153 ? quoteIdentifier ( `${ field . name } _${ field . values . join ( "_" ) } _t` )
145- : field . type . toLowerCase ( )
154+ : processType ( field . type )
146155 } ${ fieldSize (
147156 field ,
148157 diagram . database ,
0 commit comments