Thanks, Nathan. The patched code looks good! Andrew
Liquibase Community Forum wrote: > > Thanks. I committed the changes. I had to apply them manually since > patch wasn't liking the copy/paste coming from mail, so could you make > sure it's still working like you'd expect? > > Nathan > > On Sat, Oct 2, 2010 at 1:20 PM, ageery <andrew.ge...@gmail.com> wrote: >> >> PostgreSQL supports "Oracle-style" table and column comments (since at >> least >> 7.1 -- http://www.postgresql.org/docs/7.1/static/sql-comment.html). The >> patch below makes this functionality available for PostgreSQL. >> >> Thanks >> Andrew >> >> ### Eclipse Workspace Patch 1.0 >> #P liquibase-trunk >> Index: >> liquibase-core/src/main/java/liquibase/sqlgenerator/core/SetTableRemarksGenerator.java >> =================================================================== >> --- >> liquibase-core/src/main/java/liquibase/sqlgenerator/core/SetTableRemarksGenerator.java >> (revision 1770) >> +++ >> liquibase-core/src/main/java/liquibase/sqlgenerator/core/SetTableRemarksGenerator.java >> (working copy) >> @@ -3,6 +3,7 @@ >> import liquibase.database.Database; >> import liquibase.database.core.MySQLDatabase; >> import liquibase.database.core.OracleDatabase; >> +import liquibase.database.core.PostgresDatabase; >> import liquibase.exception.ValidationErrors; >> import liquibase.sql.Sql; >> import liquibase.sql.UnparsedSql; >> @@ -14,7 +15,7 @@ >> >> @Override >> public boolean supports(SetTableRemarksStatement statement, Database >> database) { >> - return database instanceof MySQLDatabase || database instanceof >> OracleDatabase; >> + return database instanceof MySQLDatabase || database instanceof >> OracleDatabase || database instanceof PostgresDatabase; >> } >> >> public ValidationErrors validate(SetTableRemarksStatement >> setTableRemarksStatement, Database database, SqlGeneratorChain >> sqlGeneratorChain) { >> @@ -27,7 +28,7 @@ >> public Sql[] generateSql(SetTableRemarksStatement statement, Database >> database, SqlGeneratorChain sqlGeneratorChain) { >> String sql; >> String remarks = >> database.escapeStringForDatabase(statement.getRemarks()); >> - if (database instanceof OracleDatabase) { >> + if (!(database instanceof MySQLDatabase)) { >> sql = "COMMENT ON TABLE >> "+database.escapeTableName(statement.getSchemaName(), >> statement.getTableName())+" IS '"+remarks+"'"; >> } else { >> sql = "ALTER TABLE >> "+database.escapeTableName(statement.getSchemaName(), >> statement.getTableName())+" COMMENT = '"+remarks+"'"; >> Index: >> liquibase-core/src/main/java/liquibase/sqlgenerator/core/SetColumnRemarksGeneratorOracle.java >> =================================================================== >> --- >> liquibase-core/src/main/java/liquibase/sqlgenerator/core/SetColumnRemarksGeneratorOracle.java >> (revision 1770) >> +++ >> liquibase-core/src/main/java/liquibase/sqlgenerator/core/SetColumnRemarksGeneratorOracle.java >> (working copy) >> @@ -2,6 +2,7 @@ >> >> import liquibase.database.Database; >> import liquibase.database.core.OracleDatabase; >> +import liquibase.database.core.PostgresDatabase; >> import liquibase.exception.ValidationErrors; >> import liquibase.sql.Sql; >> import liquibase.sql.UnparsedSql; >> @@ -17,7 +18,7 @@ >> >> @Override >> public boolean supports(SetColumnRemarksStatement statement, Database >> database) { >> - return database instanceof OracleDatabase; >> + return database instanceof OracleDatabase || database instanceof >> PostgresDatabase; >> } >> >> public ValidationErrors validate(SetColumnRemarksStatement >> setColumnRemarksStatement, Database database, SqlGeneratorChain >> sqlGeneratorChain) { >> >> -- >> View this message in context: >> http://old.nabble.com/Table---column-comments-in-PG-tp29867445p29867445.html >> Sent from the LiquiBase - User mailing list archive at Nabble.com. >> >> >> ------------------------------------------------------------------------------ >> Start uncovering the many advantages of virtual appliances >> and start using them to simplify application deployment and >> accelerate your shift to cloud computing. >> http://p.sf.net/sfu/novell-sfdev2dev >> _______________________________________________ >> Liquibase-user mailing list >> Liquibase-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/liquibase-user >> > > ------------------------------------------------------------------------------ > Virtualization is moving to the mainstream and overtaking non-virtualized > environment for deploying applications. Does it make network security > easier or more difficult to achieve? Read this whitepaper to separate the > two and get a better understanding. > http://p.sf.net/sfu/hp-phase2-d2d > _______________________________________________ > Liquibase-user mailing list > Liquibase-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/liquibase-user > > -- View this message in context: http://old.nabble.com/Table---column-comments-in-PG-tp29867445p29904409.html Sent from the LiquiBase - User mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb _______________________________________________ Liquibase-user mailing list Liquibase-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/liquibase-user