View Issue Details

IDProjectCategoryView StatusLast Update
0001153SymmetricDSBugpublic2019-04-11 19:21
Reporterborball Assigned To 
Prioritynormal 
Status closedResolutionwon't fix 
Product Version3.3.4 
Summary0001153: Drop tables in Database failed
DescriptionCan not drop tables when call API: public void alterDatabase(Database desiredDatabase, boolean continueOnError) in org.jumpmind.db.platform.IDatabasePlatform
Steps To Reproduce1. create one table in datasource with IDatabasePlatform.createTables()
2. drop the table with :
        Database oldDatabase = readDatabase(dataSource);
        for (Table table : tables) {
            oldDatabase.removeTable(table);
        }
        getDatabasePlatform(dataSource).alterDatabase(oldDatabase, false);
3. The table is still there.
Additional InformationPotension issues in Code: org.jumpmind.db.platform.AbstractDatabasePlatform
public void alterTables(boolean continueOnError, Table... desiredTables) {
        Database currentDatabase = new Database();
        Database desiredDatabase = new Database();
        StringBuilder tablesProcessed = new StringBuilder();
        for (Table table : desiredTables) {
            tablesProcessed.append(table.getFullyQualifiedTableName());
            tablesProcessed.append(", ");
            desiredDatabase.addTable(table);
            Table currentTable = ddlReader.readTable(table.getCatalog(), table.getSchema(),
                    table.getName());
            if (currentTable != null) {
                currentDatabase.addTable(currentTable);
            }
        }

        if (tablesProcessed.length() > 1) {
            tablesProcessed.replace(tablesProcessed.length() - 2, tablesProcessed.length(), "");
        }

        String alterSql = ddlBuilder.alterDatabase(currentDatabase, desiredDatabase);

        if (StringUtils.isNotBlank(alterSql.trim())) {
            log.info("Running alter sql:\n{}", alterSql);
            String delimiter = getDdlBuilder().getDatabaseInfo().getSqlCommandDelimiter();
            new SqlScript(alterSql, getSqlTemplate(), !continueOnError, false, false, delimiter, null).execute();
        } else {
            log.info("Tables up to date. No alters found for {}", tablesProcessed);
        }

    }
TagsNo tags attached.

Activities

chenson

2013-04-26 17:11

administrator   ~0000248

This was intentional. We are only processing the tables specified in the database. We could probably clean up the api to allow the entire database to be diffed and to generate drops.

Issue History

Date Modified Username Field Change
2013-03-31 09:27 borball New Issue
2013-04-26 17:11 chenson Note Added: 0000248
2019-04-11 19:21 admin Status new => closed
2019-04-11 19:21 admin Resolution open => won't fix