Examples of PostgresDatabase


Examples of liquibase.database.core.PostgresDatabase

        JdbcConnection jdbcConnection = new JdbcConnection(connection);

        Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(jdbcConnection);

        if (database instanceof PostgresDatabase) {
          database = new PostgresDatabase() {
            @Override
            public String escapeObjectName(String objectName, Class<? extends DatabaseObject> objectType) {
              return objectName;
            }
          };
View Full Code Here

Examples of liquibase.database.core.PostgresDatabase

  @Test
  public void shouldDropIndexInPostgreSQL() throws Exception {
    DropIndexGenerator dropIndexGenerator = new DropIndexGenerator();
    DropIndexStatement statement = new DropIndexStatement("indexName", "defaultCatalog", "defaultSchema", "aTable", null);
    Database database = new PostgresDatabase();
    SortedSet<SqlGenerator> sqlGenerators = new TreeSet<SqlGenerator>();
    SqlGeneratorChain sqlGenerationChain = new SqlGeneratorChain(sqlGenerators);
    Sql[] sqls = dropIndexGenerator.generateSql(statement, database, sqlGenerationChain);
    assertEquals("DROP INDEX \"defaultSchema\".\"indexName\"", sqls[0].toSql());
View Full Code Here

Examples of liquibase.database.core.PostgresDatabase

      }
    }

    @Test
    public void createReferencesSchemaEscaped() throws Exception {
        Database database = new PostgresDatabase();
        database.setOutputDefaultSchema(true);
        database.setDefaultSchemaName("my-schema");
        CreateTableStatement statement = new CreateTableStatement(CATALOG_NAME, SCHEMA_NAME, TABLE_NAME);
        statement.addColumnConstraint(new ForeignKeyConstraint("fk_test_parent", TABLE_NAME + "(id)").setColumn("id"));
        Sql[] generatedSql = this.generatorUnderTest.generateSql(statement, database, null);
        assertEquals("CREATE TABLE SCHEMA_NAME.TABLE_NAME (, CONSTRAINT fk_test_parent FOREIGN KEY (id) REFERENCES my-schema.TABLE_NAME(id))", generatedSql[0].toSql());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.