static String getSqlAddColumn ( EntityType entityType , Attribute attr , ColumnMode columnMode ) { StringBuilder sql = new StringBuilder ( "ALTER TABLE " ) ; String columnSql = getSqlColumn ( entityType , attr , columnMode ) ; sql . append ( getTableName ( entityType ) ) . append ( " ADD " ) . append ( columnSql ) ; List < String > sqlTableConstraints = getSqlTableConstraints ( entityType , attr ) ; if ( ! sqlTableConstraints . isEmpty ( ) ) { sqlTableConstraints . forEach ( sqlTableConstraint -> sql . append ( ",ADD " ) . append ( sqlTableConstraint ) ) ; } return sql . toString ( ) ; }
Returns SQL string to add a column to an existing table .