Package liquibase.database

Examples of liquibase.database.Database


        // NOTE: We do not use DBReset.performDBReset() here, since DBReset deletes the schema, which requires there to
        //       be no active connections to the DB. Liquibase.dropAll(), on the other hand, just deletes all the
        //       objects in the DB, which has no such requirement.
        String dbDriver = DatabaseFactory.getInstance().findDefaultDriver(testDs.connectionUrl);
        Database database = CommandLineUtils.createDatabaseObject(DbSetupUtility.class.getClassLoader(),
            testDs.connectionUrl, testDs.userName, testDs.password, dbDriver, null, null, null);
        //Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(
        //    new JdbcConnection(AbstractEJB3Test.getConnection()));
        Liquibase liquibase = new Liquibase(null, new ClassLoaderResourceAccessor(), database);
        liquibase.dropAll();
View Full Code Here


         
          /*
           * The default implementation of Liquibase for Oracle has an error in the default Schema
           * lookup, so we'll set it here to avoid problems.
           */
          Database db = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(jdbcConn);
          if (dbType == DbType.ORACLE) {
            db.setDefaultSchemaName(metaDataUserName);
          }
         
          /*
           * Derby doesn't support the CREATE OR REPLACE syntax for Views and Liquibase will throw
           * an error if the attribute is specified for Derby or H2.
View Full Code Here

         
          /*
           * The default implementation of Liquibase for Oracle has an error in the default Schema
           * lookup, so we'll set it here to avoid problems.
           */
          Database db = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(jdbcConn);
          if (dbType == DbType.ORACLE) {
            db.setDefaultSchemaName(metaDataUserName);
          }
         
          /*
           * Derby doesn't support the CREATE OR REPLACE syntax for Views and Liquibase will throw
           * an error if the attribute is specified for Derby or H2.
View Full Code Here

        if (namespace.getBoolean("views")) {
            compareTypes.add(View.class);
        }

        final DiffToChangeLog diffToChangeLog = new DiffToChangeLog(new DiffOutputControl());
        final Database database = liquibase.getDatabase();

        final String filename = namespace.getString("output");
        if (filename != null) {
            try (PrintStream file = new PrintStream(filename, StandardCharsets.UTF_8.name())) {
                generateChangeLog(database, database.getDefaultSchema(), diffToChangeLog, file, compareTypes);
            }
        } else {
            generateChangeLog(database, database.getDefaultSchema(), diffToChangeLog, System.out, compareTypes);
        }
    }
View Full Code Here

            liquibase = new CloseableLiquibase(dataSource);
        } else {
            liquibase = new CloseableLiquibase(dataSource, migrationsFile);
        }

        final Database database = liquibase.getDatabase();
        final String catalogName = namespace.getString("catalog");
        final String schemaName = namespace.getString("schema");

        if(database.supportsCatalogs() && catalogName != null) {
            database.setDefaultCatalogName(catalogName);
            database.setOutputDefaultCatalog(true);
        }
        if(database.supportsSchemas() && schemaName != null) {
            database.setDefaultSchemaName(schemaName);
            database.setOutputDefaultSchema(true);
        }

        return liquibase;
    }
View Full Code Here

        DataSource dataSource = getDataSource(sessionFactory);
        connection = dataSource.getConnection();
        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;
            }
          };
          database.setConnection(jdbcConnection);
        }

        Liquibase liq = new Liquibase("migrations.xml", accessor, database);
        liq.update("prod");
      } finally {
View Full Code Here

  @PostConstruct
  protected void bootstrap() {
    ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor(getClass().getClassLoader());
    try (Connection connection = ds.getConnection()) {
      JdbcConnection jdbcConnection = new JdbcConnection(connection);
      Database db = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(jdbcConnection);

      Liquibase liquiBase = new Liquibase(CHANGELOG_FILE, resourceAccessor, db);
      liquiBase.update(STAGE);
    } catch (SQLException | LiquibaseException e) {
    }
View Full Code Here

         
          /*
           * The default implementation of Liquibase for Oracle has an error in the default Schema
           * lookup, so we'll set it here to avoid problems.
           */
          Database db = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(jdbcConn);
          if (dbType == DbType.ORACLE) {
            db.setDefaultSchemaName(metaDataUserName);
          }
         
          /*
           * Derby doesn't support the CREATE OR REPLACE syntax for Views and Liquibase will throw
           * an error if the attribute is specified for Derby or H2.
View Full Code Here

        if (migrationFile == null) {
            throw new IllegalArgumentException("database.migrationFile must be set in order to run database migration.");
        }
        try {
            UrsusJDBCDataSource ursusJDBCDataSource = new UrsusJDBCDataSource(ursusJDBCConfiguration);
            Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(ursusJDBCDataSource.getConnection()));
            Liquibase liquibase = new Liquibase(migrationFile, new ClassLoaderResourceAccessor(), database);

            Liquibase_Command liquibaseCommand = Liquibase_Command.valueOf(command.toLowerCase());

            if (liquibaseCommand.equals(Liquibase_Command.dropall))
View Full Code Here

    @Override
    public void runLiquibaseCommand(UrsusJDBCConfiguration.Database ursusJDBCConfiguration, String command) {
        try {
            UrsusJDBCDataSource ursusJDBCDataSource = new UrsusJDBCDataSource(ursusJDBCConfiguration);
            Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(ursusJDBCDataSource.getConnection()));
            Liquibase liquibase = new Liquibase(ursusJDBCConfiguration.getMigrationFile(), new ClassLoaderResourceAccessor(), database);

            Liquibase_Command liquibaseCommand = Liquibase_Command.valueOf(command.toLowerCase());

            if (liquibaseCommand.equals(Liquibase_Command.dropall))
View Full Code Here

TOP

Related Classes of liquibase.database.Database

Copyright © 2018 www.massapicom. 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.