You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by "Rainer Döbele (JIRA)" <em...@incubator.apache.org> on 2018/09/12 08:06:00 UTC
[jira] [Commented] (EMPIREDB-279) Sequences left after dropping my
Database. Can't create a new one.
[ https://issues.apache.org/jira/browse/EMPIREDB-279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16611730#comment-16611730 ]
Rainer Döbele commented on EMPIREDB-279:
----------------------------------------
Dear Björn,
thanks for letting us know.
I have investigated this and fixed it for HSQL and Oracle.
> Sequences left after dropping my Database. Can't create a new one.
> ------------------------------------------------------------------
>
> Key: EMPIREDB-279
> URL: https://issues.apache.org/jira/browse/EMPIREDB-279
> Project: Empire-DB
> Issue Type: Bug
> Components: Core
> Reporter: Björn Johannisson
> Priority: Minor
>
> Dropping the full Database should remove it completly. I can't create a new DB, because there are still parts of the old one left. In this case, they are the sequences.
> The following error appears, while building the db new:
> INFO [2018/09/05 14:00]: An Error occured. Message is: The database operation failed. Native error is: Es gibt bereits ein Objekt mit diesem Namen
> at org.apache.empire.exceptions.EmpireException.log(EmpireException.java:124)
> org.apache.empire.db.exceptions.EmpireSQLException: The database operation failed. Native error is: Es gibt bereits ein Objekt mit diesem Namen
> Drop the sequences at this positions, please:
> org.apache.empire.db.mysql DBDatabaseDriverMySQL.class method:getDDLScript //Table case DROP:
> org.apache.empire.db.oracle DBDAtabaseDriverOracle.class method:getDDLScript //Table case DROP:
> org.apache.empire.db.hsql DBDAtabaseDriverHSql.class method:getDDLScript //Table case DROP:
> All drivers use sequences. The method to drop them is usable in all three classes. If there is no sequence for the table, nothing happens.
> following opperation should be added to the script, before dropping the table itself:
> for (DBColumn c : table.getPrimaryKey().getColumns())
> {
> if (c.getDataType() == DataType.AUTOINC && c instanceof DBTableColumn)
> {
> DBTableColumn x = (DBTableColumn) c;
> script.addStmt("drop sequence " + x.getDefaultValue());
> }
> }
> this Operation was part of my workaround for that problem.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)